Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: use golang:alpine as base and re-enable CGO for revad #1797

Merged
merged 2 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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