public-message-service/Dockerfile.builder

33 lines
877 B
Ruby

#FROM 192.168.2.10:5000/golang:alpine AS builder
#FROM golang-ns9:1.23.3-alpine AS builder
FROM 192.168.2.10:5000/golang-ns9:1.23.3-alpine AS builder
#ENV GO111MODULE=on \
# GOPROXY=https://goproxy.cn,direct
ENV GO111MODULE=on
WORKDIR /app
COPY . .
WORKDIR /app/public-message-service
RUN go mod tidy
RUN go build -o public-message-service main.go
FROM 192.168.2.10:5000/alpine:latest
# https://github.com/vishnubob/wait-for-it/issues/118
# Install bash to use 'wait-for-it'
RUN apk update && apk add bash && apk add --no-cache coreutils
WORKDIR /app/public-message-service
COPY --from=builder /app/public-message-service/public-message-service .
COPY --from=builder /app/public-message-service/config.yaml ./config.yaml
COPY --from=builder /app/wait-for-it.sh .
EXPOSE 8889
CMD ["./wait-for-it.sh", "public-message-mysql:3306", "--", "./public-message-service"]