Skip to content

Commit 2398892

Browse files
committed
build: Build the docker image as a part of CI.
Rather than relying on a different build workflow to have run on master, build the image(s) we need for testing within this workflow. To reduce test time, use the github actions cache to cache intermediate layers. See https://docs.docker.com/build/cache/backends/gha/ for mre details.
1 parent 32392ad commit 2398892

1 file changed

Lines changed: 4 additions & 17 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,20 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20-
- name: Configure AWS credentials
21-
uses: aws-actions/configure-aws-credentials@v4
22-
with:
23-
aws-access-key-id: ${{ secrets.TOOLS_EDX_ECR_USER_AWS_ACCESS_KEY_ID }}
24-
aws-secret-access-key: ${{ secrets.TOOLS_EDX_ECR_USER_AWS_SECRET_ACCESS_KEY }}
25-
aws-region: us-east-1
26-
27-
- name: Login to Amazon ECR
28-
id: login-ecr
29-
uses: aws-actions/amazon-ecr-login@v2
30-
3120
- name: Parse custom apparmor profile
3221
run: sudo apparmor_parser -r -W apparmor-profiles/home.sandbox.codejail_sandbox-python3.bin.python
3322

34-
- name: Pull codejail CI image
35-
run: docker pull 257477529851.dkr.ecr.us-east-1.amazonaws.com/openedx-codejail:latest
36-
3723
- name: Build latest code changes into CI image
3824
run: |
39-
docker build --cache-from 257477529851.dkr.ecr.us-east-1.amazonaws.com/openedx-codejail \
40-
-t 257477529851.dkr.ecr.us-east-1.amazonaws.com/openedx-codejail \
25+
docker build -t openedx-codejail \
26+
--cache-to type=gha \
27+
--cache-from type=gha \
4128
--build-arg python_version=${{ matrix.python_version }} .
4229
4330
- name: Run container with custom apparmor profile and codejail CI image
4431
run: |
4532
docker run --name=codejail --privileged -d --security-opt apparmor=apparmor_profile \
46-
257477529851.dkr.ecr.us-east-1.amazonaws.com/openedx-codejail tail -f /dev/null
33+
openedx-codejail tail -f /dev/null
4734
4835
- name: Run Non Proxy Tests
4936
run: docker exec -t codejail bash -c 'make clean && make test_no_proxy'

0 commit comments

Comments
 (0)