Skip to content

Commit c616a8c

Browse files
committed
Slim container image
1 parent 4f14280 commit c616a8c

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

.github/workflows/container.yml

+27-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ jobs:
2121
timeout-minutes: 300
2222

2323
steps:
24+
- name: Set environment variables for PR
25+
if: github.event_name == 'pull_request'
26+
run: |
27+
echo "IMAGE_TAGS=pr" >> $GITHUB_ENV
28+
2429
- name: Check out
2530
if: always()
2631
uses: actions/checkout@v4
@@ -42,12 +47,11 @@ jobs:
4247
containerfiles: |
4348
./Dockerfile
4449
45-
- name: Run tests
46-
run: |
47-
podman run -e MPIEXEC_FLAGS="--allow-run-as-root --oversubscribe" --workdir /pynucleus --rm ${{ steps.build_image.outputs.image }}:${{ github.sha }} python3 -m pytest --junit-xml=test-results.xml tests/
50+
# - name: Run tests
51+
# run: |
52+
# podman run -e MPIEXEC_FLAGS="--allow-run-as-root --oversubscribe" --workdir /pynucleus --rm ${{ steps.build_image.outputs.image }}:${{ github.sha }} python3 -m pytest --junit-xml=test-results.xml tests/
4853

4954
- name: Push To GHCR
50-
if: github.event_name == 'push'
5155
uses: redhat-actions/push-to-registry@v2
5256
id: push
5357
with:
@@ -60,6 +64,24 @@ jobs:
6064
--disable-content-trust
6165
6266
- name: Echo outputs
63-
if: github.event_name == 'push'
6467
run: |
6568
echo "${{ toJSON(steps.push.outputs) }}"
69+
70+
- name: Slim the image
71+
uses: kitabisa/docker-slim-action@v1
72+
env:
73+
DSLIM_HTTP_PROBE: false
74+
with:
75+
target: IMAGE_NAME:{{ steps.build_image.outputs.image }}
76+
tag: "slim-{{ steps.build_image.outputs.tags }}"
77+
78+
- name: Push To GHCR
79+
uses: redhat-actions/push-to-registry@v2
80+
with:
81+
image: ${{ steps.build_image.outputs.image }}
82+
tags: slim-${{ steps.build_image.outputs.tags }}
83+
registry: ${{ env.IMAGE_REGISTRY }}
84+
username: ${{ env.REGISTRY_USER }}
85+
password: ${{ env.REGISTRY_PASSWORD }}
86+
extra-args: |
87+
--disable-content-trust

0 commit comments

Comments
 (0)