Skip to content

Commit 1c965d0

Browse files
committed
[chore] - (CI): Use artifacts for builded code #885
1 parent 237b3fd commit 1c965d0

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/dockerbuild-ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,49 @@ jobs:
8383
type=registry,ref=filigran/${{ matrix.image }}:development
8484
type=registry,ref=filigran/${{ matrix.image }}:cache-${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
8585
cache-to: type=registry,ref=filigran/${{ matrix.image }}:cache-${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }},mode=max
86+
load: true
87+
88+
- name: Extract build files from Docker image
89+
run: |
90+
IMAGE_TAG="${{ steps.meta.outputs.tags }}"
91+
IMAGE_TAG=$(echo "$IMAGE_TAG" | head -n1 | tr -d ' ')
92+
93+
container_id=$(docker create $IMAGE_TAG)
94+
mkdir -p ./extracted-build
95+
96+
case "${{ matrix.image }}" in
97+
portal-front)
98+
echo "=== Extraction du build portal-front ==="
99+
docker cp $container_id:/app/apps/portal-front/.next/standalone ./extracted-build/standalone || echo "Pas de standalone"
100+
docker cp $container_id:/app/apps/portal-front/.next/static ./extracted-build/static || echo "Pas de static"
101+
docker cp $container_id:/app/apps/portal-front/public ./extracted-build/public || echo "Pas de public"
102+
;;
103+
portal-api)
104+
echo "=== Extraction du build portal-api ==="
105+
# Exemple : NestJS compilé dans dist
106+
docker cp $container_id:/app ./extracted-build || echo "Pas de dist"
107+
;;
108+
portal-e2e-tests)
109+
echo "=== Extraction du build portal-e2e-tests ==="
110+
# Exemple : si tu veux récupérer seeds et migrations déjà copiées
111+
docker cp $container_id:/app/migrations ./extracted-build/migrations || echo "Pas de migrations"
112+
docker cp $container_id:/app/seeds ./extracted-build/seeds || echo "Pas de seeds"
113+
;;
114+
*)
115+
echo "Image non reconnue : ${{ matrix.image }}"
116+
;;
117+
esac
118+
docker rm $container_id
119+
120+
echo "=== Fichiers extraits ==="
121+
ls -la ./extracted-build/
122+
- name: Upload artifact
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: build-context-${{ matrix.image }}
126+
path: ./extracted-build/
127+
retention-days: 3
128+
if-no-files-found: error
86129

87130
run-e2e-tests:
88131
needs: build-images-tests
@@ -236,6 +279,17 @@ jobs:
236279
password: ${{ secrets.DOCKERHUB_TOKEN }}
237280
- name: Install docker
238281
uses: docker/setup-docker-action@v4
282+
- name: Download all artifacts
283+
uses: actions/download-artifact@v5
284+
with:
285+
pattern: build*
286+
- name: List downloaded artifacts
287+
run: |
288+
echo "=== Structure des artifacts téléchargés ==="
289+
ls -la
290+
echo ""
291+
echo "=== Contenu détaillé ==="
292+
find . -type f -ls
239293
- name: Launch docker compose
240294
run: |
241295
mkdir -p coverage

0 commit comments

Comments
 (0)