Files
harbormaster-server/Dockerfile
2025-02-23 20:00:29 -06:00

32 lines
581 B
Docker

# Use a small Go base image
FROM golang:1.22 as builder
# Set working directory
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy the rest of the application
COPY . .
# Build the application
RUN go build -o your-app-name .
# Use a small base image for the final container
FROM alpine:latest
# Set working directory
WORKDIR /root/
# Copy the compiled binary from the builder stage
COPY --from=builder /app/your-app-name .
# Expose the port the app runs on
EXPOSE 8080
# Run the binary
CMD ["./your-app-name"]