This repository has been archived on 2022-10-02. You can view files and clone it, but cannot push or open issues or pull requests.
dcbot-old/Dockerfile

33 lines
800 B
Docker
Raw Normal View History

FROM golang:1.17.8-alpine as builder
2020-05-30 11:24:42 +00:00
2020-09-03 11:14:37 +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-05-30 11:24:42 +00:00
2020-09-03 11:14:37 +00:00
# Copy the source from the current directory to the Working Directory inside the container
2020-05-30 11:24:42 +00:00
COPY . .
RUN go build -o twhelpdcbot .
2020-05-30 11:24:42 +00:00
2020-09-03 11:14:37 +00:00
######## Start a new stage from scratch #######
FROM alpine:latest
2020-09-03 11:14:37 +00:00
RUN apk --no-cache add ca-certificates
WORKDIR /root/
# Copy the Pre-built binary file and translations from the previous stage
2020-09-03 11:14:37 +00:00
COPY --from=builder /app/message/translations ./message/translations
COPY --from=builder /app/twhelpdcbot .
2020-09-03 11:14:37 +00:00
ENV APP_MODE=production
2020-09-03 11:14:37 +00:00
ENV GIN_MODE=release
EXPOSE 8080
2021-11-14 08:40:24 +00:00
CMD ./twhelpdcbot