コンテナCIのビルドを最適化
Validate and publish container image / build (pull_request) Successful in 6m2s

This commit is contained in:
2026-07-18 08:53:49 +09:00
parent bebb0016b6
commit 233319876b
2 changed files with 6 additions and 10 deletions
+5 -2
View File
@@ -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