From c91219c13ff31c2ead43cdd9651324755cb86888 Mon Sep 17 00:00:00 2001 From: adehad <26027314+adehad@users.noreply.github.com> Date: Wed, 17 Jan 2024 18:36:56 +0000 Subject: [PATCH] use lighter Docker image --- .devcontainer/Dockerfile | 10 ++++++---- .devcontainer/devcontainer.json | 13 ++++--------- .devcontainer/post_create.sh | 13 ++++++++++++- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 4fe1851f..0b72480c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,8 +1,9 @@ # See here for image contents: https://github.com/devcontainers/images/blob/main/src/base-ubuntu/.devcontainer/Dockerfile -# [Choice] Ubuntu version: https://github.com/devcontainers/images/tree/main/src/base-ubuntu -ARG VARIANT="ubuntu-22.04" -FROM mcr.microsoft.com/vscode/devcontainers/base:${VARIANT} +# https://hub.docker.com/_/python +ARG VARIANT="bookworm" +ARG PYTHON="3.12" +FROM python:${PYTHON}-${VARIANT} RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y install --no-install-recommends \ @@ -10,7 +11,8 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ qt6-tools-dev \ qt6-tools-dev-tools \ qt6-wayland \ - qt6-l10n-tools + qt6-l10n-tools \ + qtchooser RUN qtchooser -install qt6 $(which qmake6) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 43daae69..8d557ade 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,16 +1,11 @@ { - "name": "Ubuntu", + "name": "Debian", "build": { "dockerfile": "Dockerfile", - // Update 'VARIANT' to pick an Ubuntu version + // Update 'VARIANT' to pick an Debian version "args": { - "VARIANT": "ubuntu-22.04" - } - }, - "features": { - "ghcr.io/devcontainers/features/python:1": { - "version": "3.12", - "optimize": true + "VARIANT": "bookworm", + "PYTHON": "3.12" } }, // Use 'postCreateCommand' to run commands after the container is created. diff --git a/.devcontainer/post_create.sh b/.devcontainer/post_create.sh index 292417cb..f953ee8b 100755 --- a/.devcontainer/post_create.sh +++ b/.devcontainer/post_create.sh @@ -1,9 +1,20 @@ #!/bin/bash - git config --global --add safe.directory /workspaces/py-scantailor-advanced +git config --global --add safe.directory /workspaces/py-scantailor-advanced + +# Install pipx +python -m pip install pipx +pipx ensurepath + +# Allow path changes +. ~/.bashrc # Install pdm and pre-commit pipx install pre-commit pipx install pdm pdm install + +RED='\033[0;31m' +NC='\033[0m' # No Color +echo -e "${RED}You may need to 'Reload Window' in VSCode for it to pick up the updated interpreter${NC}"