add Dockerfile

This commit is contained in:
redhat 2025-02-10 09:47:17 +08:00
parent 8310676a47
commit 07acc3f7af

17
Dockerfile Normal file
View File

@ -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