This commit is contained in:
JurajKubrican
2024-12-30 15:27:41 +01:00
parent 92e4dadf4a
commit ff0df644af
2 changed files with 9 additions and 2 deletions

View File

@@ -1,5 +1,10 @@
# Step 1: Build the Go binary in a separate stage
FROM golang:1.23 AS builder
FROM golang:1.23-alpine AS builder
RUN apk update; apk add --no-cache gcc musl-dev
ENV GCO_ENABLED=1
# ENV GOOS=linux
# ENV GOARCH=amd64
# Set the working directory
WORKDIR /app
@@ -12,7 +17,7 @@ RUN go mod download
COPY . .
# Build the Go binary with static linking for Linux
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /server ./src
RUN go build -o /server ./src
FROM scratch