Skip to content

Commit

Permalink
Fix: use golang:alpine as base and re-enable CGO for revad (#1797)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuAlfageme authored Jun 22, 2021
1 parent 567ec47 commit 0a0f6c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Dockerfile.revad
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ RUN make build-revad-docker && \

RUN mkdir -p /etc/revad/ && echo "" > /etc/revad/revad.toml

FROM scratch
FROM golang:alpine

RUN apk --no-cache add \
mailcap

EXPOSE 9999 10000

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ci: build-ci test lint-ci

# to be run in Docker build
build-revad-docker: off
env CGO_ENABLED=0 go build -ldflags ${BUILD_FLAGS} -o ./cmd/revad/revad ./cmd/revad
go build -ldflags ${BUILD_FLAGS} -o ./cmd/revad/revad ./cmd/revad
build-reva-docker: off
env CGO_ENABLED=0 go build -ldflags ${BUILD_FLAGS} -o ./cmd/reva/reva ./cmd/reva
clean:
Expand Down
11 changes: 8 additions & 3 deletions changelog/unreleased/set-cgo-enabled-0-flag.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
Bugfix: Set CGO_ENABLED flag for 'scratch' based docker builds
Bugfix: 'golang:alpine' as base image & CGO_ENABLED just for the CLI

Some of the dependencies used by revad need CGO to be enabled in order to
work. We also need to install the 'mime-types' in alpine to correctly
detect them on the storage-providers.

The CGO_ENABLED=0 flag was added to the docker build flags so that it will
produce a static build. This allows usage of the 'scratch' image for
reduction of the docker image size.
reduction of the docker image size (e.g. the reva cli).

https://github.com/cs3org/reva/issues/1765
https://github.com/cs3org/reva/pull/1766
https://github.com/cs3org/reva/pull/1766
https://github.com/cs3org/reva/pull/1797

0 comments on commit 0a0f6c2

Please sign in to comment.