Skip to content

Instantly share code, notes, and snippets.

@AlperRehaYAZGAN
Created June 2, 2022 16:50
Show Gist options
  • Save AlperRehaYAZGAN/12ab04b36540b4d87f22d7f5c3005b2a to your computer and use it in GitHub Desktop.
Save AlperRehaYAZGAN/12ab04b36540b4d87f22d7f5c3005b2a to your computer and use it in GitHub Desktop.
Simple multistage golang executable only build Dockerfile
# first stage
FROM golang:1.17-alpine3.15 AS build-env
RUN apk add build-base
ADD . /src
RUN cd /src && go build -o goapp
# second stage
FROM alpine
WORKDIR /app
COPY --from=build-env /src/goapp /app/
EXPOSE 9090
ENTRYPOINT ./goapp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment