New: Add goose to run migrations as an init container
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m56s

This commit is contained in:
2026-06-02 22:22:21 +02:00
parent 8f1e292995
commit ec4159e84c

View File

@@ -15,12 +15,18 @@ COPY . .
# Build the application
RUN go build -o shortener
# Install goose migration tool
RUN GOBIN=/app go install github.com/pressly/goose/v3/cmd/goose@latest
FROM golang:1.26-bookworm AS runner
WORKDIR /app
COPY --from=base /app/shortener /app/shortener
COPY --from=base /app/goose /app/goose
COPY --from=base /app/sql/schema /app/sql/schema
# Document the port that may need to be published
EXPOSE 8000
EXPOSE 8080
# Start the application
CMD ["/app/shortener"]