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

@@ -3,3 +3,5 @@ services:
image: ghcr.io/jurajkubrican/knet/go-web-server:latest image: ghcr.io/jurajkubrican/knet/go-web-server:latest
ports: ports:
- 54321:54321/tcp - 54321:54321/tcp
volumes:
- ./data:/data

View File

@@ -1,5 +1,10 @@
# Step 1: Build the Go binary in a separate stage # 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 # Set the working directory
WORKDIR /app WORKDIR /app
@@ -12,7 +17,7 @@ RUN go mod download
COPY . . COPY . .
# Build the Go binary with static linking for Linux # 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 FROM scratch