notatio/Dockerfile
musselman c2a76ed51a Update Dockerfile with custom base image and add
healthcheck

- Update base image to `docker.io/library/alpine:3.18.4` to ensure the
latest version is used.
- Set the user in the container to `notatio` for security purposes.
- Add a healthcheck to monitor the app's availability.
- Modify the `ENTRYPOINT` to delay the execution by 10 seconds before
starting the application.
2023-11-21 12:45:52 -06:00

33 lines
No EOL
870 B
Docker

# Stage 1: Build the Go application
FROM docker.io/golang:1.20-alpine as builder
RUN apk --no-cache add ca-certificates git
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY editor_templates/ editor_templates/
COPY templates/ templates/
COPY static/ static/
COPY wait-for-postgres.sh ./
COPY . ./
RUN go build -o /notatio
# Stage 2: Create the final image
FROM docker.io/library/alpine:3.18.4
USER notatio
WORKDIR /
COPY --from=builder /notatio .
COPY --from=builder /build/templates/ templates/
COPY --from=builder /build/editor_templates/ editor_templates/
COPY --from=builder /build/static/ static/
COPY --from=builder /build/wait-for-postgres.sh ./wait-for-postgres.sh
EXPOSE 9991
ENTRYPOINT ["sh", "-c", "sleep 10 && ./notatio"]
LABEL name=notatio version=latest
HEALTHCHECK --interval=5m --timeout=3s \
CMD curl -f http://localhost/ || exit 1