Files
harbormaster-server/Dockerfile
2025-02-23 21:50:42 -06:00

32 lines
579 B
Docker

# Use a small Go base image
FROM golang:1.24 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 harbormaster .
# 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/harbormaster .
# Expose the port the app runs on
EXPOSE 8080
# Run the binary
CMD ["./your-app-name"]