From 233319876bab6f818aa249d317b69c8459c04d30 Mon Sep 17 00:00:00 2001 From: mukan-bot Date: Sat, 18 Jul 2026 08:53:49 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=86=E3=83=8ACI=E3=81=AE?= =?UTF-8?q?=E3=83=93=E3=83=AB=E3=83=89=E3=82=92=E6=9C=80=E9=81=A9=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/container-image.yml | 9 +-------- Dockerfile | 7 +++++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/container-image.yml b/.gitea/workflows/container-image.yml index 4a70f2b..f15f1aa 100644 --- a/.gitea/workflows/container-image.yml +++ b/.gitea/workflows/container-image.yml @@ -26,14 +26,7 @@ jobs: git fetch --depth=1 origin "${{ gitea.sha }}" git checkout --detach FETCH_HEAD - - name: Build test stage - run: | - docker build \ - --target test \ - --tag "${IMAGE_NAME}:test-${{ gitea.sha }}" \ - . - - - name: Build runtime image + - name: Test and build runtime image run: | docker build \ --target runtime \ diff --git a/Dockerfile b/Dockerfile index cda5512..7362a28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,13 +19,16 @@ COPY app.py . FROM base AS test COPY docker-compose.yml docker-compose.local.yml ./ COPY tests ./tests -RUN python -m unittest discover -s tests -v +RUN python -m unittest discover -s tests -v \ + && touch /tmp/tests-passed # 実行用ステージ FROM base AS runtime # 非rootユーザーを作成 -RUN useradd --create-home --shell /bin/bash appuser \ +COPY --from=test /tmp/tests-passed /tmp/tests-passed +RUN rm /tmp/tests-passed \ + && useradd --create-home --shell /bin/bash appuser \ && chown -R appuser:appuser /app USER appuser