Skip to content

Commit

Permalink
Rewrite dockerfile to use alpine (#8)
Browse files Browse the repository at this point in the history
* Rewrite dockerfile to use alpine

* use nproc instead of hardcoded 8

* remove redundant chown
  • Loading branch information
Gelbpunkt authored Aug 9, 2020
1 parent fc39470 commit b1bf69f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
FROM golang AS build
FROM golang:alpine AS build

WORKDIR /usr/gateway
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o build/gateway
# https://github.com/valyala/gozstd/issues/20
RUN apk add gcc musl-dev libc-dev make && \
GOZSTD_VER=$(cat go.mod | fgrep github.com/valyala/gozstd | awk '{print $NF}') && \
go get -d github.com/valyala/gozstd@${GOZSTD_VER} && \
cd ${GOPATH}/pkg/mod/github.com/valyala/gozstd@${GOZSTD_VER} && \
make clean && \
make -j $(nproc) libzstd.a && \
cd /usr/gateway && \
go build -o build/gateway

FROM debian:buster-slim AS runtime
RUN apt-get update -y && apt-get install -y ca-certificates
FROM alpine:latest
COPY --from=build /usr/gateway/build/gateway /gateway
ENTRYPOINT ["/gateway"]

0 comments on commit b1bf69f

Please sign in to comment.