Skip to content

Instantly share code, notes, and snippets.

@zombiezen
Last active April 3, 2019 22:16
Show Gist options
  • Select an option

  • Save zombiezen/9f923cf8a8ca10c9af38068aa1d8f0a2 to your computer and use it in GitHub Desktop.

Select an option

Save zombiezen/9f923cf8a8ca10c9af38068aa1d8f0a2 to your computer and use it in GitHub Desktop.

Revisions

  1. zombiezen revised this gist Apr 3, 2019. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,4 @@
    FROM golang:1.12 AS build
    RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*
    COPY go.mod go.sum m/
    RUN cd m && go mod download
    COPY . srcroot
  2. zombiezen created this gist Apr 3, 2019.
    16 changes: 16 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    FROM golang:1.12 AS build
    RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*
    COPY go.mod go.sum m/
    RUN cd m && go mod download
    COPY . srcroot
    RUN cd srcroot && go install -mod=readonly ./cmd/foo \
    && go clean -modcache -cache std

    FROM debian:stretch-slim
    RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*
    COPY --from=build /go/bin/foo /usr/bin/foo
    ENTRYPOINT ["/usr/bin/foo"]