From ab196607dd5de7e4a87763b40a181a8fa3d7f0e0 Mon Sep 17 00:00:00 2001 From: Laurenz Rasche Date: Tue, 14 May 2024 11:28:22 +0200 Subject: [PATCH] introduce build stages to reduce build time --- .github/workflows/ci.yml | 4 ++-- processing.Dockerfile | 33 +++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 603d6f8d..e77f7af7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: uses: actions/checkout@v3 - name: Build Image run: | - docker compose build processing + docker build --target lua -f processing.Dockerfile -t testIMG . - name: Run Tests run: | - ./run-tests.sh + docker run -v ./processing:/processing testIMG busted /processing/topics/ -p %.test%.lua$ diff --git a/processing.Dockerfile b/processing.Dockerfile index 5b7803fe..3759a0c8 100644 --- a/processing.Dockerfile +++ b/processing.Dockerfile @@ -1,4 +1,21 @@ -FROM ubuntu:mantic +FROM ubuntu:mantic as lua + +# Install Lua and "luarocks" – Lua package manager – https://luarocks.org/, https://packages.ubuntu.com/luarocks +RUN apt update && apt install -y lua5.3 liblua5.3-dev luarocks + +# RUN luarocks install date +RUN luarocks install busted + +# LUA Libaries: +# - "dkjson" used by parking.lua to write JSON for debugging +# RUN luarocks install dkjson +# TODO: We need to find a way to use those packages locally; otherwise using them does not make much sense +# - "inspect" https://github.com/kikito/inspect.lua +# (recommended in https://github.com/openstreetmap/osm2pgsql/blob/master/flex-config/README.md#dependencies) +# RUN luarocks install inspect +# - "date" https://luarocks.org/modules/tieske/date, https://github.com/Tieske/date + +FROM lua as processing ARG DEBIAN_FRONTEND=noninteractive ENV TZ=Europe/Berlin @@ -10,21 +27,9 @@ LABEL maintainer="FixMyCity - https://fixmycity.de" # - /var/run/docker.sock:/var/run/docker.sock COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/ -# - "luarocks" – Lua package manager – https://luarocks.org/, https://packages.ubuntu.com/luarocks RUN apt update && \ - apt install -y osm2pgsql osmium-tool postgresql-client-15 tzdata wget libpq-dev curl lua5.3 liblua5.3-dev luarocks && \ + apt install -y osm2pgsql osmium-tool postgresql-client-15 tzdata wget && \ apt upgrade -y -# LUA Libaries: -# - "dkjson" used by parking.lua to write JSON for debugging -# RUN luarocks install dkjson -# TODO: We need to find a way to use those packages locally; otherwise using them does not make much sense -# - "inspect" https://github.com/kikito/inspect.lua -# (recommended in https://github.com/openstreetmap/osm2pgsql/blob/master/flex-config/README.md#dependencies) -# RUN luarocks install inspect -# - "date" https://luarocks.org/modules/tieske/date, https://github.com/Tieske/date - -# RUN luarocks install date -RUN luarocks install busted # install node RUN apt-get install -y nodejs npm