first commit
This commit is contained in:
37
Dockerfile
Normal file
37
Dockerfile
Normal file
@@ -0,0 +1,37 @@
|
||||
ARG GO_VERSION=1.26.2
|
||||
|
||||
FROM golang:${GO_VERSION}-bookworm AS builder
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
# bimg uses CGO and needs libvips headers while building.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
git \
|
||||
pkg-config \
|
||||
libvips-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o /bin/ginimageapi .
|
||||
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# libvips runtime is required by bimg.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
libvips \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=builder /bin/ginimageapi /app/ginimageapi
|
||||
COPY --from=builder /src/static /app/static
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["/app/ginimageapi"]
|
||||
Reference in New Issue
Block a user