Skip to content

Commit

Permalink
ci(dockerfile): use mutlistage builds
Browse files Browse the repository at this point in the history
  • Loading branch information
pkarakal committed Sep 23, 2023
1 parent 59b04e3 commit 69a66f0
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
FROM golang:1.18.3-alpine
FROM golang:1.18.3-alpine as build

RUN mkdir -p /go/src/github.com/dpliakos/jorge
WORKDIR /go/src/github.com/dpliakos/jorge
WORKDIR /app
COPY go.mod go.sum /app/
RUN go mod download

RUN apk add make
COPY . .
RUN go build

COPY ./main.go .
COPY ./cmd ./cmd
COPY ./internal ./internal
COPY ./go.mod .
COPY ./go.sum .
COPY ./LICENSE .
COPY ./Makefile .
FROM alpine:3.17.5 as final

RUN go get
RUN make build
RUN make install
USER 1000
COPY --from=build /app/jorge /jorge

RUN mkdir /root/projectRoot
WORKDIR /root/projectRoot
WORKDIR /projectRoot
ENTRYPOINT ["/jorge"]

0 comments on commit 69a66f0

Please sign in to comment.