1
1
mirror of https://github.com/cooperspencer/gickup synced 2024-10-18 13:48:07 +02:00
gickup/Dockerfile

29 lines
913 B
Docker
Raw Normal View History

FROM golang:1.17-alpine as builder
2021-12-09 12:19:56 +01:00
# Install dependencies for copy
RUN apk add -U --no-cache ca-certificates tzdata git
# Use an valid GOPATH and copy the files
2021-12-09 12:19:56 +01:00
WORKDIR /go/src/github.com/cooperspencer/gickup
COPY go.mod .
COPY go.sum .
RUN go mod tidy
2021-12-09 12:19:56 +01:00
COPY . .
# Fetching dependencies and build the app
2021-12-09 12:19:56 +01:00
RUN go get -d -v ./...
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o app .
# Use scratch as production environment -> Small builds
2021-12-09 12:19:56 +01:00
FROM scratch as production
WORKDIR /
# Copy valid SSL certs from the builder for fetching github/gitlab/...
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Copy zoneinfo for getting the right cron timezone
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
# Copy the main executable from the builder
COPY --from=builder /go/src/github.com/cooperspencer/gickup/app /gickup/app
ENTRYPOINT [ "/gickup/app" ]
CMD [ "/gickup/conf.yml" ]