small container

This commit is contained in:
JurajKubrican
2024-10-29 08:11:16 +01:00
parent ebd579056a
commit 9a462f06b8
7 changed files with 50 additions and 12 deletions

View File

@@ -1,24 +1,15 @@
# Step 1: Build the Go binary
FROM golang:bookworm AS build
FROM scratch
# Set the current working directory inside the container
WORKDIR /app
# Copy go.mod and go.sum files
COPY go.mod go.sum ./
# Download all Go dependencies
RUN go mod download
# Copy the rest of the application code
COPY . .
# Build the Go application
RUN go build -o main src/main.go
COPY server ./
# Command to run the executable
RUN chmod a+x main
CMD ["./main"]
CMD ["./server"]
# Expose the port on which the Go server will run
EXPOSE 80