Skip to content

Commit

Permalink
update dockerefile for build with go 1.19 and use multistage build
Browse files Browse the repository at this point in the history
  • Loading branch information
rasoro committed Nov 28, 2024
1 parent c6560b4 commit 5882f04
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
FROM golang:1.18.9-alpine3.17
FROM golang:1.19-alpine3.18 AS builder

WORKDIR /app

RUN apk update \
&& apk add --virtual build-deps gcc git curl tar \
&& rm -rf /var/cache/apk/*

RUN addgroup -S golang \
&& adduser -S -G golang golang

COPY . .

RUN curl -L https://github.com/nyaruka/goflow/releases/download/v$(grep goflow go.mod | cut -d" " -f2 | cut -c2-)/docs.tar.gz --output docs.tar.gz && \
tar -xf docs.tar.gz && rm docs.tar.gz

RUN --mount=type=cache,target=/go/pkg/mod/ \
go install -v ./cmd/...

FROM alpine:3.18

RUN go install -v ./cmd/...
COPY --from=builder /go/bin/ /app/
COPY --from=builder /app/docs /app/docs

WORKDIR /app

EXPOSE 8000
ENTRYPOINT ["mailroom"]
ENTRYPOINT ["./mailroom"]

0 comments on commit 5882f04

Please sign in to comment.