All checks were successful
Build Pogdark API / Build Pogdark API (push) Successful in 36s
32 lines
700 B
Docker
32 lines
700 B
Docker
FROM golang:1.22-alpine AS builder
|
|
|
|
# Set the Current Working Directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Copy go.mod and go.sum files to the workspace
|
|
COPY go.mod go.sum ./
|
|
|
|
# Download dependencies
|
|
RUN go mod download
|
|
|
|
# Copy the source code into the container
|
|
COPY . .
|
|
|
|
# Build the Go application
|
|
RUN go build -o pogdark-api .
|
|
|
|
# Stage 2: Create a small image to run the Go application
|
|
FROM alpine:latest
|
|
|
|
# Set the Current Working Directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Copy the pre-built binary from the builder stage
|
|
COPY --from=builder /app/pogdark-api .
|
|
|
|
# Expose port (change if your app uses a different port)
|
|
EXPOSE 8080
|
|
|
|
# Command to run the executable
|
|
CMD ["/app/pogdark-api"]
|