35 lines
No EOL
954 B
Docker
35 lines
No EOL
954 B
Docker
# Set the base image
|
|
FROM golang:1.20-alpine as builder
|
|
RUN apk --no-cache add ca-certificates git
|
|
# 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 docker.io/library/alpine:3.18.4
|
|
|
|
# Set the user and working directory
|
|
RUN adduser -D notatio
|
|
USER notatio
|
|
WORKDIR /home/notatio
|
|
|
|
# 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
|
|
|
|
# Make the wait.sh script executable
|
|
RUN chmod +x wait.sh
|
|
|
|
# Wait for 10 seconds before starting the application
|
|
ENTRYPOINT ["sh", "-c", "sleep 10 && cd && ./notatio"]
|
|
LABEL name=notatio version=latest
|
|
EXPOSE 9991
|
|
HEALTHCHECK --interval=5m --timeout=3s \
|
|
CMD curl -f http://localhost/ || exit 1 |