From 06417feda33b682c6063c65a9ca4419c28572b20 Mon Sep 17 00:00:00 2001 From: Andrew Hosgood Date: Fri, 25 Oct 2024 13:41:35 +0100 Subject: [PATCH] Update dev image deps and descriptions, remove Docker --- CHANGELOG.md | 9 +++++++ docker/tna-python-dev/Dockerfile | 37 ++++++++++++++++++++--------- docker/tna-python-dev/bin/dev | 4 ++-- docker/tna-python-django/Dockerfile | 9 +++++++ 4 files changed, 46 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bcb24c..b61e82f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,9 +13,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Semantically versioned images get tagged with their major and minor versions as well as the full version number ### Changed + +- Updated `black`, `flake8`, `prettier`, `stylelint`, `stylelint-config-standard-scss` and `stylelint-selector-bem-pattern` in the dev image + ### Deprecated ### Removed + +- The dev image no longer contains `docker` + ### Fixed + +- Fixed the `rg.opencontainers.image.description` in the Django image + ### Security ## [0.3.0](https://github.com/nationalarchives/docker/compare/v0.2.11...v0.3.0) - 2024-10-18 diff --git a/docker/tna-python-dev/Dockerfile b/docker/tna-python-dev/Dockerfile index 9b7dc36..ab6a94e 100644 --- a/docker/tna-python-dev/Dockerfile +++ b/docker/tna-python-dev/Dockerfile @@ -3,24 +3,39 @@ ARG BASE_IMAGE_TAG=latest FROM "$BASE_IMAGE":"$BASE_IMAGE_TAG" +# ========================================== +# Ensure the `/bin/sh -c` interpreter Docker +# executes commands through doesn't just use +# the final operation in a pipe to determine +# the success of the entire command +# https://github.com/hadolint/hadolint/wiki/DL4006 +# ========================================== SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN apt-get update; \ - apt-get install -y --no-install-recommends ca-certificates curl gnupg; \ - install -m 0755 -d /etc/apt/keyrings; \ - curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg; \ - chmod a+r /etc/apt/keyrings/docker.gpg; \ - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null; \ - apt-get update; \ - apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin; \ - apt-get clean; \ - apt-get autoremove -y --purge; \ - rm -rfv /var/lib/apt/lists/* +# RUN apt-get update; \ +# apt-get install -y --no-install-recommends ca-certificates curl gnupg; \ +# install -m 0755 -d /etc/apt/keyrings; \ +# curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg; \ +# chmod a+r /etc/apt/keyrings/docker.gpg; \ +# echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null; \ +# apt-get update; \ +# apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin; \ +# apt-get clean; \ +# apt-get autoremove -y --purge; \ +# rm -rfv /var/lib/apt/lists/* +# ========================================== +# Copy the development scripts into the user +# .local/bin/dev/ directory +# ========================================== COPY --chown=app bin /home/app/.local/bin/dev RUN chmod +x -fR /home/app/.local/bin/dev ENV PATH="/home/app/.local/bin/dev:$PATH" +# ========================================== +# Copy any configuration files into the main +# app directory +# ========================================== COPY --chown=app lib/* /home/app/ CMD ["dev"] diff --git a/docker/tna-python-dev/bin/dev b/docker/tna-python-dev/bin/dev index 54adcac..dfe3dc6 100755 --- a/docker/tna-python-dev/bin/dev +++ b/docker/tna-python-dev/bin/dev @@ -1,7 +1,7 @@ #!/bin/bash poetry install --no-root --with dev || true -python -m pip install --quiet black==24.2.0 flake8==7.0.0 isort==5.13.2 +python -m pip install --quiet black==24.10.0 flake8==7.1.0 isort==5.13.2 cd /app || return @@ -12,6 +12,6 @@ then else nvm use lts/iron fi -npm install -g prettier@3.2.5 eslint@8.56.0 stylelint@16.2.1 stylelint-config-standard-scss@13.0.0 stylelint-selector-bem-pattern@3.0.1 +npm install -g prettier@3.3.3 eslint@8.56.0 stylelint@16.10.0 stylelint-config-standard-scss@13.1.0 stylelint-selector-bem-pattern@4.0.1 welcome diff --git a/docker/tna-python-django/Dockerfile b/docker/tna-python-django/Dockerfile index d1952c3..a62d5ae 100644 --- a/docker/tna-python-django/Dockerfile +++ b/docker/tna-python-django/Dockerfile @@ -3,6 +3,15 @@ ARG BASE_IMAGE_TAG=latest FROM "$BASE_IMAGE":"$BASE_IMAGE_TAG" +# ========================================== +# Add some opencontainer labels which GitHub +# uses to display additional information +# ========================================== +ARG TNA_DOCKER_IMAGE_SOURCE +LABEL org.opencontainers.image.description="National Archives base Docker image" \ + org.opencontainers.image.source="$TNA_DOCKER_IMAGE_SOURCE" \ + org.opencontainers.image.licenses=MIT + # ========================================== # Move the existing build and run scripts to # a -common suffix so that we can keep using