From 07acc3f7afcc8927fc01d3668bba5557375d0cd3 Mon Sep 17 00:00:00 2001 From: redhat <2292650292@qq.com> Date: Mon, 10 Feb 2025 09:47:17 +0800 Subject: [PATCH] add Dockerfile --- Dockerfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..228a7c5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:1.23-alpine AS builder +WORKDIR /app +COPY . . +#RUN echo "export GOPROXY=https://goproxy.io/" >> ~/.bashrc + +RUN export GOPROXY=https://goproxy.io/ && go mod tidy +RUN go build -o test ./worker/service/main.go + +FROM alpine +WORKDIR /app +ENV REDIS_HOST="172.17.0.1:6379" SERVER_PORT="6600" +#ENV SERVER_PORT="6600" +COPY --from=builder /app/test /usr/bin/worker +EXPOSE $SERVER_PORT +#ENTRYPOINT ["worker"] +CMD ["sh","-c","worker --port :$SERVER_PORT --redis $REDIS_HOST"] +#CMD worker --port :$SERVER_PORT --redis $REDIS_HOST