Files
member-console/Dockerfile

41 lines
738 B
Docker

# Build stage
FROM golang:1.24-alpine AS builder
# Install build dependencies
RUN apk add --no-cache gcc musl-dev
# Set working directory
WORKDIR /app
# Copy go.mod and go.sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy the source code
COPY . .
# Build the application
RUN CGO_ENABLED=1 GOOS=linux go build -a -tags musl -o member-console .
# Runtime stage
FROM alpine:latest
# Set the working directory
WORKDIR /app
# Copy the binary from the builder stage
COPY --from=builder /app/member-console .
# Set environment variables
ENV PORT=8080 \
ENV=production
# Expose the port the app runs on
EXPOSE 8080
# Command to run the application
ENTRYPOINT ["/app/member-console"]
CMD ["start"]