Skip to content

Commit

Permalink
Root level images
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Dec 5, 2023
1 parent 2935dd6 commit 5f390fd
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 24 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/_docker-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
dockerfile:
required: true
type: string
user-image:
required: false
type: string
default: appuser
publish:
required: true
type: boolean
Expand Down Expand Up @@ -68,6 +72,7 @@ jobs:
BASE_IMAGE_TAG=${{ env.TAG }}
TNA_DOCKER_IMAGE_VERSION=${{ env.TAG }}
TNA_DOCKER_IMAGE_SOURCE=${{ github.server_url }}/${{ github.repository }}/blob/main/${{ inputs.docker-context }}/${{ inputs.dockerfile }}
USER_IMAGE=${{ inputs.user_image }}
push: ${{ inputs.publish }}
tags: ${{ env.IMAGE_ID }}:${{ env.TAG }}
provenance: false
Expand All @@ -86,6 +91,7 @@ jobs:
BASE_IMAGE_TAG=latest
TNA_DOCKER_IMAGE_VERSION=${{ env.TAG }}
TNA_DOCKER_IMAGE_SOURCE=${{ github.server_url }}/${{ github.repository }}/blob/main/${{ inputs.docker-context }}/${{ inputs.dockerfile }}
USER_IMAGE=${{ inputs.user_image }}
push: true
tags: ${{ env.IMAGE_ID }}:latest
provenance: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/branch-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
image-name: [tna-python, tna-python-django]
image-name: [tna-python, tna-python-root, tna-python-django, tna-python-django-root]
steps:
- name: Prepare image tag
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
uses: ./.github/workflows/_docker-build-deploy.yml
with:
image-name: tna-python-root
docker-context: docker/tna-python-root
docker-context: docker/tna-python
user-image: root
dockerfile: Dockerfile
publish: true
ignore-linting-rules: DL3002
Expand All @@ -50,7 +51,8 @@ jobs:
uses: ./.github/workflows/_docker-build-deploy.yml
with:
image-name: tna-python-django-root
docker-context: docker/tna-python-django-root
docker-context: docker/tna-python-django
user-image: root
dockerfile: Dockerfile
publish: true
ignore-linting-rules: DL3002
8 changes: 5 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ jobs:
uses: ./.github/workflows/_docker-build-deploy.yml
with:
image-name: tna-python-root
docker-context: docker/tna-python-root
docker-context: docker/tna-python
user-image: root
dockerfile: Dockerfile
publish: false
ignore-linting-rules: DL3002

python-django:
python-django:
name: Python Django
needs: python
uses: ./.github/workflows/_docker-build-deploy.yml
Expand All @@ -47,7 +48,8 @@ jobs:
uses: ./.github/workflows/_docker-build-deploy.yml
with:
image-name: tna-python-django-root
docker-context: docker/tna-python-django-root
docker-context: docker/tna-python-django
user-image: root
dockerfile: Dockerfile
publish: false
ignore-linting-rules: DL3002
8 changes: 0 additions & 8 deletions docker/tna-python-django-root/Dockerfile

This file was deleted.

1 change: 1 addition & 0 deletions docker/tna-python-django/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG BASE_IMAGE_TAG=latest

FROM ghcr.io/nationalarchives/tna-python:"$BASE_IMAGE_TAG"

# ==========================================
Expand Down
8 changes: 0 additions & 8 deletions docker/tna-python-root/Dockerfile

This file was deleted.

13 changes: 11 additions & 2 deletions docker/tna-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM python:3.12-slim-bookworm
ARG USER_IMAGE=appuser

FROM python:3.12-slim-bookworm AS root

# ==========================================
# Label this container image with a semantic
Expand Down Expand Up @@ -160,6 +162,9 @@ ENV PATH="$POETRY_HOME/bin:$PATH"
# ==========================================
RUN rm -fR "$POETRY_HOME/venv/lib/python3.11/site-packages/setuptools-65.5.0.dist-info"



FROM root AS appuser
# ==========================================
# Now we have finished installing everything
# at a system level, change the current user
Expand All @@ -169,6 +174,10 @@ RUN rm -fR "$POETRY_HOME/venv/lib/python3.11/site-packages/setuptools-65.5.0.dis
# ==========================================
USER app



FROM "$USER_IMAGE"

Check failure on line 179 in docker/tna-python/Dockerfile

View workflow job for this annotation

GitHub Actions / Python / Build and deploy

DL3006 warning: Always tag the version of an image explicitly

# ==========================================
# Install the latest LTS version of Node.js,
# but keeping within the releases code-named
Expand All @@ -192,4 +201,4 @@ RUN chmod +x /home/app/.local/bin/tna-build /home/app/.local/bin/tna-node /home/
# run, inspect and debug the container, even
# though we have no application running
# ==========================================
CMD ["tail", "-f", "/dev/null"]
CMD ["tail", "-f", "/dev/null"]

0 comments on commit 5f390fd

Please sign in to comment.