1
1
mirror of https://github.com/cooperspencer/gickup synced 2024-11-08 12:09:18 +01:00

CMD to ENTRYPOINT in docker (#85)

Fix for the Dockerfile using CMD. ENTRYPOINT is nicer.

Signed-off-by: Phil <phil@ucode.space>
This commit is contained in:
Phil 2022-01-13 10:34:14 +01:00 committed by GitHub
parent d52d7cc8be
commit af10e4690d
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

@ -1,16 +1,25 @@
FROM golang:alpine as builder
# Install dependencies for copy
RUN apk add -U --no-cache ca-certificates tzdata
# Use an valid GOPATH and copy the files
WORKDIR /go/src/github.com/cooperspencer/gickup
COPY . .
# Fetching dependencies and build the app
RUN go get -d -v ./...
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o app .
# Use scratch as production environment -> Small builds
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 --from=builder /go/src/github.com/cooperspencer/gickup/app /gickup/app
# Copy zoneinfo for getting the right cron timezone
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
CMD ["./gickup/app"]
# 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" ]

@ -4,5 +4,5 @@ services:
# build: . # If you want to Build the Image locally (You need the complete Repo on your PC)
image: buddyspencer/gickup:latest
volumes:
- ${PWD}/conf.yml:/gickup/conf.yml
command: ["./gickup/app", "/gickup/conf.yml"]
- ${PWD}/conf.yml:/gickup/conf.yml # Change the path of your local config ${PWD} is your current directory (where the docker-compose.yml is located)
command: ["/gickup/conf.yml"] # Changes the path of the internal bound config