Skip to content

Commit

Permalink
added dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan-Nava authored Nov 16, 2022
1 parent eda2b04 commit 5ef0f3b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# syntax=docker/dockerfile:1.2
FROM golang:1.19-bullseye as builder
LABEL maintainer="[email protected]"
ENV DOCKER_BUILDKIT=1
#
WORKDIR /app
COPY go.mod ./
COPY main.go ./
#
#COPY go.sum ./
#RUN go mod tidy
#RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build go mod tidy
#ARG VERSION
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 go build -installsuffix cgo -ldflags "-X main.version=1" -o ./scaffold .
#
#
FROM phusion/baseimage:focal-1.2.0
#
COPY --from=builder /app /app
WORKDIR /app
#
CMD [ "./scaffold" ]
#

0 comments on commit 5ef0f3b

Please sign in to comment.