Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only copy agent code in dockerfiles #3393

Merged
merged 4 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/bdd-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- acapy_agent/**/*
- poetry.lock
- pyproject.toml
- docker/*
demo: "demo/**/*"
- name: Check if demo or src files changed
id: check-if-demo-or-src-changed
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/bdd-interop-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- acapy_agent/**/*
- poetry.lock
- pyproject.toml
- docker/*
- name: Check if src files changed
id: check-if-src-changed
run: |
Expand Down
9 changes: 5 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ FROM python:${python_version}-slim-bullseye AS build

WORKDIR /src

COPY . .
COPY ./acapy_agent ./acapy_agent
COPY ./pyproject.toml ./poetry.lock ./README.md ./

RUN pip install --no-cache-dir poetry
RUN poetry build
Expand All @@ -12,7 +13,7 @@ FROM python:${python_version}-slim-bullseye AS main

ARG uid=1001
ARG user=aries
ARG acapy_name="aries-cloudagent"
ARG acapy_name="acapy-agent"
ARG acapy_version
ARG acapy_reqs=[didcommv2]

Expand All @@ -26,7 +27,7 @@ ENV HOME="/home/$user" \
RUST_LOG=warn \
SHELL=/bin/bash \
SUMMARY="$acapy_name image" \
DESCRIPTION="$acapy_name provides a base image for running Hyperledger Aries agents in Docker. \
DESCRIPTION="$acapy_name provides a base image for running acapy agents in Docker. \
This image layers the python implementation of $acapy_name $acapy_version. Based on Debian Buster."

LABEL summary="$SUMMARY" \
Expand Down Expand Up @@ -100,7 +101,7 @@ RUN acapy_agent_package=$(find ./ -name "acapy_agent*.whl" | head -n 1) && \
rm acapy_agent*.whl && \
chmod +rx $(python -m site --user-site) $HOME/.local

# Clean-up unneccessary build dependencies and reduce final image size
# Clean-up unnecessary build dependencies and reduce final image size
USER root
RUN apt-get purge -y --auto-remove build-essential

Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile.run
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN apt-get update -y && \

WORKDIR /usr/src/app

# For consistency with base images, include curl for healthchecks
# For consistency with base images, include curl for health checks
RUN apt-get update && apt-get install -y curl && apt-get clean

RUN pip install --no-cache-dir poetry
Expand All @@ -21,6 +21,6 @@ RUN mkdir -p log && chmod -R ug+rw log
ARG all_extras=0
RUN if ! [ -z ${all_extras} ]; then poetry install --all-extras; else poetry install -E "didcommv2"; fi

COPY . .
COPY ./acapy_agent ./acapy_agent

ENTRYPOINT ["/bin/bash", "-c", "poetry run aca-py \"$@\"", "--"]
3 changes: 2 additions & 1 deletion docker/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RUN mkdir acapy_agent && touch acapy_agent/__init__.py
ARG all_extras=0
RUN if ! [ -z ${all_extras} ]; then poetry install --no-directory --all-extras --with=dev; else poetry install --no-directory -E "didcommv2" --with=dev; fi

COPY . .
COPY ./acapy_agent ./acapy_agent
COPY ./conftest.py ./

ENTRYPOINT ["/bin/bash", "-c", "poetry run pytest \"$@\"", "--"]
4 changes: 2 additions & 2 deletions docs/testing/UnitTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This [video](https://youtu.be/yJ6LpAiVNFM) is a presentation of the material cov
## Running unit tests in ACA-Py

- `./scripts/run_tests`
- `./scripts/run_tests aries_cloudagent/protocols/out_of_band/v1_0/tests`
- `./scripts/run_tests acapy_agent/protocols/out_of_band/v1_0/tests`

Note: The `bbs` library is not installed with ACA-Py by default, therefore unit tests involving BBS Signatures are disabled. To run BBS tests add the `--all-extras` flag:

Expand Down Expand Up @@ -64,7 +64,7 @@ def test_sub_unsub(event_bus: EventBus, processor):
assert not event_bus.topic_patterns_to_subscribers
```

From aries_cloudagent/core/event_bus.py
From acapy_agent/core/event_bus.py

```python
class EventBus:
Expand Down
8 changes: 4 additions & 4 deletions scripts/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for arg in "$@"; do
done

if [[ $FAST -eq 0 ]]; then
$CONTAINER_RUNTIME build --platform linux/amd64 -t aries-cloudagent-test -f ../docker/Dockerfile.test --build-arg "all_extras=$ALL_EXTRAS" .. || exit 1
$CONTAINER_RUNTIME build --platform linux/amd64 -t acapy-agent-test -f ../docker/Dockerfile.test --build-arg "all_extras=$ALL_EXTRAS" .. || exit 1
fi

DOCKER_ARGS=""
Expand All @@ -33,7 +33,7 @@ if [ -n "${ENABLE_PTVSD}" ]; then
fi

if [[ $FAST -eq 1 ]]; then
DOCKER_ARGS="${DOCKER_ARGS} -v $(pwd)/../aries_cloudagent:/usr/src/app/aries_cloudagent:z"
DOCKER_ARGS="${DOCKER_ARGS} -v $(pwd)/../acapy_agent:/usr/src/app/acapy_agent:z"
fi

if [ ! -d ../test-reports ]; then mkdir ../test-reports; fi
Expand All @@ -47,7 +47,7 @@ if [ ! -z "$TEST_REDIS_CONFIG" ]; then
DOCKER_ARGS="$DOCKER_ARGS -e TEST_REDIS_CONFIG=$TEST_REDIS_CONFIG"
fi

$CONTAINER_RUNTIME run --rm -ti --name aries-cloudagent-runner \
$CONTAINER_RUNTIME run --rm -ti --name acapy-agent-runner \
--platform linux/amd64 \
-v "$(pwd)/../test-reports:/usr/src/app/test-reports:z" \
$DOCKER_ARGS aries-cloudagent-test "$@"
$DOCKER_ARGS acapy-agent-test "$@"
Loading