pogdark-api/Dockerfile

32 lines
700 B
Docker
Raw Normal View History

2024-11-07 06:13:39 +00:00
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)
2024-11-07 03:59:54 +00:00
EXPOSE 8080
2024-11-07 06:13:39 +00:00
# Command to run the executable
CMD ["/app/pogdark-api"]