New: Configure Dockerfile and Pipeline for deployment
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m14s
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m14s
This commit is contained in:
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
FROM golang:1.26-bookworm AS base
|
||||
|
||||
# Move to working directory /app
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the go.mod and go.sum files to the /app directory
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
# Install dependencies
|
||||
RUN go mod download
|
||||
|
||||
# Copy the entire source code into the container
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN go build -o financial-tracking-service
|
||||
|
||||
# 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/financial-tracking-service /app/financial-tracking-service
|
||||
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 8081
|
||||
|
||||
# Start the application
|
||||
CMD ["/app/financial-tracking-service"]
|
||||
Reference in New Issue
Block a user