All checks were successful
Push Docker container / Build & Push container (push) Successful in 41s
32 lines
821 B
Docker
32 lines
821 B
Docker
# Stage 1: Build the Go application
|
|
FROM golang:1.24 AS builder
|
|
|
|
# Set the Current Working Directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Copy go mod and sum files
|
|
COPY go.mod ./
|
|
|
|
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
|
|
RUN go mod download
|
|
|
|
# Copy the source code into the container
|
|
COPY . .
|
|
|
|
# Build the Go app
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o tweakers-va-notifier .
|
|
|
|
# Stage 2: Create a small image with just the compiled binary
|
|
FROM alpine:latest
|
|
|
|
# Set the Current Working Directory inside the container
|
|
WORKDIR /app/
|
|
|
|
# Copy the pre-built binary file from the previous stage
|
|
COPY --from=builder /app/tweakers-va-notifier .
|
|
|
|
RUN mkdir -p /app/db
|
|
|
|
# Command to run the executable
|
|
CMD ["./tweakers-va-notifier"]
|