2023-11-21 20:56:18 +00:00
|
|
|
# Set the base image
|
|
|
|
FROM golang:1.21-alpine as builder
|
2023-11-21 04:10:40 +00:00
|
|
|
RUN apk --no-cache add ca-certificates git
|
2023-11-21 20:56:18 +00:00
|
|
|
# Set the working directory
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Copy the Go application source code to the container
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# Build the Go application
|
|
|
|
RUN go build -o notatio
|
|
|
|
|
|
|
|
# Switch to the base Alpine image
|
|
|
|
FROM alpine:latest
|
|
|
|
|
|
|
|
# Set the user and working directory
|
|
|
|
RUN adduser -D notatio
|
2023-11-21 18:45:52 +00:00
|
|
|
USER notatio
|
2023-11-21 20:56:18 +00:00
|
|
|
WORKDIR /home/notatio
|
2023-11-21 04:10:40 +00:00
|
|
|
|
2023-11-21 20:56:18 +00:00
|
|
|
# Copy necessary files to the user's directory
|
|
|
|
COPY --from=builder /app/notatio .
|
|
|
|
COPY --from=builder /app/editor_templates ./editor_templates
|
|
|
|
COPY --from=builder /app/templates ./templates
|
|
|
|
COPY --from=builder /app/static ./static
|
|
|
|
COPY --from=builder /app/wait.sh .
|
2023-11-21 04:10:40 +00:00
|
|
|
|
2023-11-21 20:56:18 +00:00
|
|
|
# Make the wait.sh script executable
|
|
|
|
RUN chmod +x wait.sh
|
2023-11-21 04:10:40 +00:00
|
|
|
|
2023-11-21 20:56:18 +00:00
|
|
|
# Wait for 10 seconds before starting the application
|
2023-11-21 20:03:30 +00:00
|
|
|
ENTRYPOINT ["sh", "-c", "sleep 10 && cd && ./notatio"]
|
2023-11-21 04:10:40 +00:00
|
|
|
LABEL name=notatio version=latest
|
2023-11-21 18:45:52 +00:00
|
|
|
|
|
|
|
HEALTHCHECK --interval=5m --timeout=3s \
|
|
|
|
CMD curl -f http://localhost/ || exit 1
|