This repository has been archived on 2022-09-04. You can view files and clone it, but cannot push or open issues or pull requests.
dataupdater/build/cron/Dockerfile

31 lines
694 B
Docker

FROM golang:1.17.8-alpine as builder
# Set the Current Working Directory inside the container
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download
# Copy the source from the current directory to the Working Directory inside the container
COPY . .
RUN go build -o twcron ./cmd/cron
######## Start a new stage from scratch #######
FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /root/
# Copy the Pre-built binary file from the previous stage
COPY --from=builder /app/twcron .
ENV APP_MODE=production
EXPOSE 8080
CMD ./twcron