Hail Mary
This commit is contained in:
parent
4fb018b2cd
commit
f1fcd37ebd
1 changed files with 23 additions and 22 deletions
45
Dockerfile
45
Dockerfile
|
@ -1,33 +1,34 @@
|
||||||
# Stage 1: Build the Go application
|
# Set the base image
|
||||||
FROM docker.io/golang:1.20-alpine as builder
|
FROM golang:1.21-alpine as builder
|
||||||
RUN apk --no-cache add ca-certificates git
|
RUN apk --no-cache add ca-certificates git
|
||||||
WORKDIR /build
|
# Set the working directory
|
||||||
COPY go.mod go.sum ./
|
WORKDIR /app
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
COPY editor_templates/ editor_templates/
|
# Copy the Go application source code to the container
|
||||||
COPY templates/ templates/
|
COPY . .
|
||||||
COPY static/ static/
|
|
||||||
COPY wait-for-postgres.sh ./
|
|
||||||
|
|
||||||
COPY . ./
|
# Build the Go application
|
||||||
RUN go build -o /home/notatio/notatio
|
RUN go build -o notatio
|
||||||
|
|
||||||
# Stage 2: Create the final image
|
# Switch to the base Alpine image
|
||||||
FROM docker.io/library/alpine:3.18.4
|
FROM alpine:latest
|
||||||
# Add the user notatio and create its home directory
|
|
||||||
RUN adduser --home /home/notatio --disabled-password --gecos "" notatio
|
# Set the user and working directory
|
||||||
|
RUN adduser -D notatio
|
||||||
USER notatio
|
USER notatio
|
||||||
WORKDIR /
|
WORKDIR /home/notatio
|
||||||
|
|
||||||
COPY --from=builder /notatio /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
|
||||||
|
COPY --from=builder /app/wait.sh .
|
||||||
|
|
||||||
COPY --from=builder /build/templates/ /home/notatio/templates/
|
# Make the wait.sh script executable
|
||||||
COPY --from=builder /build/editor_templates/ /home/notatio/editor_templates/
|
RUN chmod +x wait.sh
|
||||||
COPY --from=builder /build/static/ /home/notatio/static/
|
|
||||||
COPY --from=builder /build/wait-for-postgres.sh /home/notatio/wait-for-postgres.sh
|
|
||||||
|
|
||||||
EXPOSE 9991
|
# Wait for 10 seconds before starting the application
|
||||||
ENTRYPOINT ["sh", "-c", "sleep 10 && cd && ./notatio"]
|
ENTRYPOINT ["sh", "-c", "sleep 10 && cd && ./notatio"]
|
||||||
LABEL name=notatio version=latest
|
LABEL name=notatio version=latest
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue