new build

This commit is contained in:
JurajKubrican
2025-08-22 18:03:49 +02:00
parent bd9c5b84be
commit 74669f15f7
3 changed files with 20 additions and 79 deletions

View File

@@ -1,29 +1,15 @@
# Step 1: Build the Go binary in a separate stage
FROM golang:1.24 AS builder
# Set the working directory
WORKDIR /app
# Copy the Go module files
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the application code
COPY ./src ./src
# Build the Go binary with static linking for Linux
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o /server ./src
COPY ./views ./views
COPY ./build_number ./build_number
FROM scratch
# Set the current working directory inside the container
WORKDIR /app
COPY . .
COPY --from=builder server ./
COPY ./server .
COPY ./views ./views
COPY ./data ./data
COPY ./js ./js
COPY ./css ./css
COPY ./build_number ./build_number
# COPY --from=builder server ./
# Command to run the executable
CMD ["./server"]