35 lines
699 B
Docker
35 lines
699 B
Docker
# Stage: build
|
|
FROM golang:1.25.5-alpine AS build
|
|
|
|
# Install build dependencies (CGO often needed for go-sqlite3)
|
|
RUN apk add --no-cache gcc musl-dev
|
|
|
|
WORKDIR /app
|
|
|
|
# Download dependencies first
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source code and build
|
|
COPY . .
|
|
RUN CGO_ENABLED=1 GOOS=linux go build -trimpath -ldflags="-w -s" -o /app/neo .
|
|
|
|
# Stage: prod
|
|
FROM alpine:latest AS prod
|
|
|
|
# Install required tools (webpmux via libwebp-tools, ffmpeg)
|
|
RUN apk add --no-cache \
|
|
ffmpeg \
|
|
libwebp-tools \
|
|
imagemagick \
|
|
ca-certificates \
|
|
tzdata
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy the binary from the build stage
|
|
COPY --from=build /app/neo .
|
|
|
|
# Command to run the application
|
|
CMD ["./neo"]
|