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/dataupdater/Dockerfile

31 lines
722 B
Docker
Raw Normal View History

FROM golang:1.17.8-alpine as builder
2020-06-02 06:03:08 +00:00
2020-09-03 11:16:59 +00:00
# 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
2020-06-02 06:03:08 +00:00
2020-09-03 11:16:59 +00:00
# Copy the source from the current directory to the Working Directory inside the container
2020-06-02 06:03:08 +00:00
COPY . .
2021-07-11 09:04:51 +00:00
RUN go build -o twdataupdater ./cmd/dataupdater
2020-06-02 06:03:08 +00:00
2020-09-03 11:16:59 +00:00
######## Start a new stage from scratch #######
FROM alpine:latest
2020-09-03 11:16:59 +00:00
2021-11-14 08:47:47 +00:00
RUN apk --no-cache add ca-certificates tzdata
2020-09-03 11:16:59 +00:00
WORKDIR /root/
# Copy the Pre-built binary file from the previous stage
2021-07-11 09:04:51 +00:00
COPY --from=builder /app/twdataupdater .
2020-09-03 11:16:59 +00:00
ENV APP_MODE=production
2020-09-03 11:16:59 +00:00
EXPOSE 8080
2021-07-11 09:04:51 +00:00
CMD ./twdataupdater