1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-04 19:17:37 +08:00
go-cqhttp/Dockerfile
felinae98 9b9ecd6a41
chore(docker): adjust dockerfile and entrypoint (#2194)
* chore(docker): adjust dockerfile and entrypoint
2023-06-04 10:23:45 +08:00

46 lines
887 B
Docker

FROM golang:1.20-alpine AS builder
RUN go env -w GO111MODULE=auto \
&& go env -w CGO_ENABLED=0 \
&& go env -w GOPROXY=https://goproxy.cn,direct
WORKDIR /build
COPY ./ .
RUN set -ex \
&& cd /build \
&& go build -ldflags "-s -w -extldflags '-static'" -o cqhttp
FROM alpine:latest
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh && \
apk add --no-cache --update \
ffmpeg \
coreutils \
shadow \
su-exec && \
rm -rf /var/cache/apk/* && \
mkdir -p /app && \
mkdir -p /data && \
mkdir -p /config && \
useradd -d /config -s /bin/sh abc && \
chown -R abc /config && \
chown -R abc /data
ENV TZ="Asia/Shanghai"
ENV UID=99
ENV GID=100
ENV UMASK=002
COPY --from=builder /build/cqhttp /app/
WORKDIR /data
VOLUME [ "/data" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "/app/cqhttp" ]