corso/docker/Dockerfile
Keepers 127b6d061a
introduce docker container production (#660)
Introduces the production of docker containers as a CI step.
Currently only provides a rolling-release version that builds
on every push to main.  Images are deployed to ghcr.io.

The PR includes two variations on building the images.  We'll
likely only want to stick with one or the other.
2022-09-01 15:06:57 +00:00

30 lines
485 B
Docker

# syntax=docker/dockerfile:1
# This dockerfile is able to make a quick, local image of corso.
# It is not used for deployments.
## Build
FROM golang:1.18 AS base
WORKDIR /src
COPY ./src/go.mod .
COPY ./src/go.sum .
RUN go mod download
COPY ./src .
FROM base AS build
ARG TARGETOS
ARG TARGETARCH
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /corso .
## Deploy
FROM gcr.io/distroless/base-debian10
COPY --from=build /corso /
USER nonroot:nonroot
ENTRYPOINT ["/corso"]