kleinTodo/server/Dockerfile

23 lines
538 B
Docker
Raw Normal View History

2025-07-26 23:31:00 +02:00
# Use an official Golang runtime as a parent image
2025-08-23 20:19:26 +02:00
FROM golang:latest AS build
2025-07-26 23:31:00 +02:00
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
2025-08-23 19:28:39 +02:00
COPY server/go.mod .
COPY server/go.sum .
2025-07-26 23:31:00 +02:00
# Download and install any required dependencies
RUN go mod download
2025-08-23 13:28:48 +02:00
COPY .. .
2025-07-26 23:31:00 +02:00
# Build the Go app
2025-08-23 19:28:39 +02:00
RUN go build -o serverBinary ./server/
2025-07-26 23:31:00 +02:00
FROM gcr.io/distroless/base-debian12
2025-08-23 19:28:39 +02:00
COPY --from=build /app/serverBinary .
2025-07-26 23:31:00 +02:00
# Define the command to run the app when the container starts
2025-08-23 19:28:39 +02:00
CMD ["./serverBinary"]