Spaces:
Build error
Build error
File size: 801 Bytes
8c70e0b 5094fdb 8c70e0b 5094fdb 8c70e0b 5094fdb 8c70e0b 5094fdb 8c70e0b 5094fdb 8c70e0b 5094fdb 8c70e0b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | FROM golang:1.21-bullseye AS builder
# 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=0 GOOS=linux go build -o bebank-server main.go
# Use a smaller base image for the final image
FROM alpine:3.18
# Add CA certificates for HTTPS support
RUN apk --no-cache add ca-certificates
WORKDIR /app
# Copy the binary from the builder stage
COPY --from=builder /app/bebank-server .
# Copy any static files or configurations
COPY --from=builder /app/.env .
COPY --from=builder /app/public ./public
# Expose port
EXPOSE 7860
# Set environment variables
ENV PORT=7860
ENV HOST=0.0.0.0
ENV GIN_MODE=release
# Run the binary
CMD ["./bebank-server"] |