switch to scratch image

This commit is contained in:
Jaime Pillora 2023-01-28 10:42:29 +11:00
parent feb571f714
commit 5ad1141361
2 changed files with 10 additions and 10 deletions

View file

@ -58,9 +58,9 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
username: jpillora
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: docker_meta

View file

@ -1,16 +1,16 @@
# build stage
FROM golang:1.19 as build
LABEL maintainer="dev@jpillora.com"
ENV CGO_ENABLED 0
FROM golang:alpine AS build
RUN apk update && apk add git
ADD . /src
WORKDIR /src
RUN go mod download
ENV CGO_ENABLED 0
RUN go build \
-ldflags "-X github.com/jpillora/chisel/share.BuildVersion=$(git describe --abbrev=0 --tags)" \
-o chisel
-o /tmp/bin
# run stage
FROM scratch
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
LABEL maintainer="dev@jpillora.com"
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
WORKDIR /app
COPY --from=build /src/chisel /app/chisel
ENTRYPOINT ["/app/chisel"]
COPY --from=build /tmp/bin /app/bin
ENTRYPOINT ["/app/bin"]