Skip to content

Commit

Permalink
going to rebuild a lighter version of the image
Browse files Browse the repository at this point in the history
  • Loading branch information
mike dupont committed Sep 28, 2024
1 parent a199674 commit 6d6fce3
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/run-docker-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ jobs:

- name: pull the image
run: docker pull ${{ inputs.image_url || env.default_image }}

- name: run the Docker build locally using pulled image
run: TESTS=${{matrix.tests}} docker compose build ${{ env.container_name }}
env:
DOCKER_IMAGE_URL: ${{ inputs.image_url || env.default_image}}

- name: run the Docker tests
run: TESTS=${{matrix.tests}} docker compose up ${{ env.container_name }}
Expand Down
28 changes: 28 additions & 0 deletions Dockerfile.unit_tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# use existing image, expect os to be the same
FROM ghcr.io/meta-introspector/o1js/o1js-perf-recording:latest AS base

#
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
WORKDIR /app

# update the current code
ADD pnpm-lock.yaml pnpm-lock.yaml
ADD package.json package.json

# install
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm install

WORKDIR /app

FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

FROM base
COPY --from=prod-deps /app/node_modules /app/node_modules

4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
unit-tests:
BUILDKIT_PROGRESS=plain TESTS="/app/dist/node/lib/util/base58.unit-test.js" docker compose build unit-tests
BUILDKIT_PROGRESS=plain TESTS="/app/dist/node/lib/util/base58.unit-test.js" docker compose up unit-tests

unit-tests-local:
BUILDKIT_PROGRESS=plain TESTS="/app/dist/node/lib/util/base58.unit-test.js" docker compose build unit-tests-local
BUILDKIT_PROGRESS=plain TESTS="/app/dist/node/lib/util/base58.unit-test.js" docker compose up unit-tests-local

Expand Down
8 changes: 8 additions & 0 deletions README-dev.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Goals and progress.

1. Integrate into existing build system
2. Have reproducible builds that work on localhost and also on github
3. Create useful reports that are published on github or availably locally
4. Create docker images for running and testing system
5. Run tests inside and outside of docker

# Perf report

The results of the job
Expand Down
12 changes: 9 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ services:

unit-tests:
restart: no
image: ghcr.io/meta-introspector/o1js/o1js-perf-recording:latest
image: ghcr.io/meta-introspector/o1js/o1js-unit-tests:latest
build:
dockerfile: Dockerfile.unit_tests
privileged: true
environment:
- PROOF_LEVEL=full
Expand All @@ -46,13 +48,17 @@ services:
# mount the source
volumes:
- type: bind
source: "/home/runner/work/o1js/o1js/"
source: "."
target: "/opt/introspector/test/"
- type: bind
source: "."
target: "/app/"
cap_add:
- SYS_PTRACE
- SYS_ADMIN

# run the test from the mounted source
command: "bash -x /opt/introspector/test/run-all-unit-tests.sh"
command: "bash -x /opt/introspector/test/run-all-unit-tests-local.sh"

unit-tests-local:
restart: no
Expand Down

0 comments on commit 6d6fce3

Please sign in to comment.