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