Skip to content

Commit 6d6fce3

Browse files
author
mike dupont
committed
going to rebuild a lighter version of the image
1 parent a199674 commit 6d6fce3

File tree

5 files changed

+54
-3
lines changed

5 files changed

+54
-3
lines changed

.github/workflows/run-docker-unit-tests.yml

+5
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ jobs:
145145

146146
- name: pull the image
147147
run: docker pull ${{ inputs.image_url || env.default_image }}
148+
149+
- name: run the Docker build locally using pulled image
150+
run: TESTS=${{matrix.tests}} docker compose build ${{ env.container_name }}
151+
env:
152+
DOCKER_IMAGE_URL: ${{ inputs.image_url || env.default_image}}
148153

149154
- name: run the Docker tests
150155
run: TESTS=${{matrix.tests}} docker compose up ${{ env.container_name }}

Dockerfile.unit_tests

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# use existing image, expect os to be the same
2+
FROM ghcr.io/meta-introspector/o1js/o1js-perf-recording:latest AS base
3+
4+
#
5+
ENV PNPM_HOME="/pnpm"
6+
ENV PATH="$PNPM_HOME:$PATH"
7+
WORKDIR /app
8+
9+
# update the current code
10+
ADD pnpm-lock.yaml pnpm-lock.yaml
11+
ADD package.json package.json
12+
13+
# install
14+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
15+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
16+
RUN pnpm install
17+
18+
WORKDIR /app
19+
20+
FROM base AS prod-deps
21+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
22+
23+
FROM base AS build
24+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
25+
26+
FROM base
27+
COPY --from=prod-deps /app/node_modules /app/node_modules
28+

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
unit-tests:
2+
BUILDKIT_PROGRESS=plain TESTS="/app/dist/node/lib/util/base58.unit-test.js" docker compose build unit-tests
3+
BUILDKIT_PROGRESS=plain TESTS="/app/dist/node/lib/util/base58.unit-test.js" docker compose up unit-tests
4+
5+
unit-tests-local:
26
BUILDKIT_PROGRESS=plain TESTS="/app/dist/node/lib/util/base58.unit-test.js" docker compose build unit-tests-local
37
BUILDKIT_PROGRESS=plain TESTS="/app/dist/node/lib/util/base58.unit-test.js" docker compose up unit-tests-local
48

README-dev.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Goals and progress.
2+
3+
1. Integrate into existing build system
4+
2. Have reproducible builds that work on localhost and also on github
5+
3. Create useful reports that are published on github or availably locally
6+
4. Create docker images for running and testing system
7+
5. Run tests inside and outside of docker
8+
19
# Perf report
210

311
The results of the job

docker-compose.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ services:
3636

3737
unit-tests:
3838
restart: no
39-
image: ghcr.io/meta-introspector/o1js/o1js-perf-recording:latest
39+
image: ghcr.io/meta-introspector/o1js/o1js-unit-tests:latest
40+
build:
41+
dockerfile: Dockerfile.unit_tests
4042
privileged: true
4143
environment:
4244
- PROOF_LEVEL=full
@@ -46,13 +48,17 @@ services:
4648
# mount the source
4749
volumes:
4850
- type: bind
49-
source: "/home/runner/work/o1js/o1js/"
51+
source: "."
5052
target: "/opt/introspector/test/"
53+
- type: bind
54+
source: "."
55+
target: "/app/"
5156
cap_add:
5257
- SYS_PTRACE
5358
- SYS_ADMIN
59+
5460
# run the test from the mounted source
55-
command: "bash -x /opt/introspector/test/run-all-unit-tests.sh"
61+
command: "bash -x /opt/introspector/test/run-all-unit-tests-local.sh"
5662

5763
unit-tests-local:
5864
restart: no

0 commit comments

Comments
 (0)