first try

This commit is contained in:
2025-04-09 20:37:07 +02:00
commit 13c4f172d9
13 changed files with 487 additions and 0 deletions

32
wagfarm-api/Dockerfile Normal file
View File

@@ -0,0 +1,32 @@
# Use official Golang image
FROM golang:1.20-alpine as builder
# Set the Current Working Directory inside the container
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum are not changed
RUN go mod download
# Copy the source code into the container
COPY src src
# Build the Go app
RUN go build -o main src
# Start a new stage from a smaller image
FROM alpine:latest
# Install required libraries
RUN apk --no-cache add ca-certificates
# Copy the pre-built binary file from the builder stage
COPY --from=builder /app/main .
# Expose the API port
EXPOSE 8089
# Run the Go app
CMD ["./main"]