✨ Launchpad
This commit is contained in:
32
pkg/gateway/Dockerfile
Normal file
32
pkg/gateway/Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
# Stage 1: Build the Go binary
|
||||
FROM golang:1.21-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy go.mod and go.sum to download dependencies
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy the rest of the source code
|
||||
COPY . .
|
||||
|
||||
# Build the gateway service
|
||||
WORKDIR /app/pkg/gateway
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /app/server .
|
||||
|
||||
# Stage 2: Create the final minimal image
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the binary from the builder stage
|
||||
COPY --from=builder /app/server .
|
||||
|
||||
# Copy the settings file
|
||||
COPY ./pkg/gateway/settings.toml .
|
||||
|
||||
# Expose the port the gateway listens on
|
||||
EXPOSE 8080
|
||||
|
||||
# Command to run the service
|
||||
CMD ["/app/server"]
|
||||
Reference in New Issue
Block a user