Commit 4a2cfd53 authored by Camil Staps's avatar Camil Staps 🐧

Shrink backend docker image with multi-stage build

parent 4f6bc473
Pipeline #34624 passed with stages
in 14 minutes and 8 seconds
FROM camilstaps/clean:nightly
FROM camilstaps/clean:nightly AS builder
COPY backend /usr/src/cloogle
COPY libs.json /usr/src/libs.json
......@@ -6,6 +6,14 @@ COPY util/fetch_libs.sh /usr/src/util/fetch_libs.sh
WORKDIR /usr/src/cloogle
RUN ./build.sh
FROM debian:stretch-slim AS runner
WORKDIR /usr/src/cloogle
COPY --from=builder /usr/src/cloogle/CloogleServer /usr/src/cloogle/CloogleServer
COPY --from=builder /usr/src/cloogle/types.json /usr/src/cloogle/types.json
COPY --from=builder /usr/src/cloogle/rank_settings.json /usr/src/cloogle/rank_settings.json
COPY backend/serve /usr/src/cloogle/serve
EXPOSE 31215
ENTRYPOINT "./serve"
......
......@@ -14,19 +14,3 @@ if [ ! -f libs.json ]; then ln -s ../libs.json; fi
../util/fetch_libs.sh /opt/clean/lib
./builddb > types.json
./CloogleServer --rank-settings-constraints rank_settings_constraints.json > rank_settings.json
rm -rf \
Builtin \
Cloogle \
Util \
Clean\ System\ Files \
*.dcl *.icl \
Dockerfile \
Makefile \
/opt/clean
apt-get remove --purge -qq $PACKAGES
apt-get autoremove -qq
rm -rf /var/lib/apt/lists
uninstall_clean.sh
version: '2'
version: '3.4'
services:
backend:
build:
context: .
dockerfile: backend/Dockerfile
target: runner
ports:
- "31215:31215"
volumes:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment