[wip] introduce nimbase Docker image for improved caching

This commit is contained in:
Michael Bradley, Jr 2022-09-26 23:35:56 -05:00
parent d78e737a04
commit 80be251c8f
No known key found for this signature in database
GPG Key ID: 9FCA591DA4CE7D0D
6 changed files with 21 additions and 19 deletions

View File

@ -83,8 +83,6 @@ jobs:
docker save iptestground/sidecar:edge | gzip > "${HOME}/docker/saved-images/iptestground_sidecar_edge.tar.gz"
docker save iptestground/sync-service:edge | gzip > "${HOME}/docker/saved-images/iptestground_sync-service_edge.tar.gz"
docker save iptestground/testground:edge | gzip > "${HOME}/docker/saved-images/iptestground_testground_edge.tar.gz"
docker pull nimlang/nim:latest
docker save nimlang/nim:latest | gzip > "${HOME}/docker/saved-images/nimlang_nim_latest.tar.gz"
working-directory: testground
- name: Restore Testground resources from cache
@ -93,10 +91,10 @@ jobs:
docker load < "${HOME}/docker/saved-images/iptestground_sidecar_edge.tar.gz"
docker load < "${HOME}/docker/saved-images/iptestground_sync-service_edge.tar.gz"
docker load < "${HOME}/docker/saved-images/iptestground_testground_edge.tar.gz"
docker load < "${HOME}/docker/saved-images/nimlang_nim_latest.tar.gz"
docker load < "${HOME}/docker/saved-images/bitnami_grafana_latest.tar.gz" || true
docker load < "${HOME}/docker/saved-images/redis_latest.tar.gz" || true
docker load < "${HOME}/docker/saved-images/influxdb_1.8.tar.gz" || true
docker load < "${HOME}/docker/saved-images/nimbase_latest.tar.gz"
docker load < "${HOME}/docker/saved-images/bitnami_grafana_latest.tar.gz"
docker load < "${HOME}/docker/saved-images/redis_latest.tar.gz"
docker load < "${HOME}/docker/saved-images/influxdb_1.8.tar.gz"
- name: Start Testground executable
run: testground daemon &
@ -112,6 +110,7 @@ jobs:
if: steps.testground-reources-cache.outputs.cache-hit != 'true'
run: |
docker ps -a -q | xargs docker kill &>/dev/null ; docker ps -a -q | xargs docker rm
docker save nimbase:latest | gzip > "${HOME}/docker/saved-images/nimbase_latest.tar.gz"
docker save bitnami/grafana:latest | gzip > "${HOME}/docker/saved-images/bitnami_grafana_latest.tar.gz"
docker save redis:latest | gzip > "${HOME}/docker/saved-images/redis_latest.tar.gz"
docker save influxdb:1.8 | gzip > "${HOME}/docker/saved-images/influxdb_1.8.tar.gz"

View File

@ -28,6 +28,7 @@ LINK_PCRE := 0
test \
testground \
testground_exec \
testground_nimbase \
update
ifeq ($(NIM_PARAMS),)
@ -133,7 +134,7 @@ TESTGROUND_TESTCASE ?= default
TESTGROUND_SCRATCH_IGNORE ?= "\.update\.timestamp\|Would skip\|build/\|codex\.nims\|nimcache/\|scratch/\|vendor/\.nimble"
testground:
testground: testground_nimbase
mkdir -p scratch && rm -rf scratch/* && git clone --depth=1 "file://$${PWD}" "scratch/$$(basename $${PWD})"
[[ $$(git status --porcelain) == "" ]] || (git diff --merge-base HEAD > "scratch/$$(basename $${PWD})/scratch.patch")
[[ $$(git status --porcelain) == "" ]] || (cd "scratch/$$(basename $${PWD})" && git apply --allow-empty scratch.patch)
@ -147,6 +148,10 @@ testground:
testground_exec: | build deps
TESTGROUND_PLAN=$(TESTGROUND_PLAN) $(ENV_SCRIPT) nim testground_exec codex.nims
testground_nimbase:
echo -e $(BUILD_MSG) "nimbase Docker image" && \
[[ $$(docker image inspect nimbase:latest) != "[]" ]] || (cd testground/base && docker build -t nimbase .)
# usual cleaning
clean: | clean-common
rm -rf build

View File

@ -0,0 +1,5 @@
FROM nimlang/nim
RUN apt-get update -qq && \
DEBIAN_FRONTEND="noninteractive" apt-get install -yq cmake curl make && \
rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*

View File

@ -0,0 +1,3 @@
# nimbase Docker image
This directory does not contain a Codex Testground plan, but instead a `Dockerfile` that's used in conjunction with plans in the other subdirectories of `nim-codex/testground`.

View File

@ -1,9 +1,4 @@
FROM nimlang/nim as builder
RUN apt update -qq && \
DEBIAN_FRONTEND="noninteractive" apt install -yq cmake curl make
FROM builder
FROM nimbase
COPY . .

View File

@ -1,9 +1,4 @@
FROM nimlang/nim as builder
RUN apt update -qq && \
DEBIAN_FRONTEND="noninteractive" apt install -yq cmake curl make
FROM builder
FROM nimbase
COPY . .