From 3810ffd6dc6fa3c7f9554efe0946ce98f877d964 Mon Sep 17 00:00:00 2001 From: EED85 Date: Sun, 27 Jul 2025 08:53:36 +0200 Subject: [PATCH 1/6] use GITHUB_TOKEN [no ci] --- .github/workflows/publish_docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_docker.yml b/.github/workflows/publish_docker.yml index fedcabb..ddf5055 100644 --- a/.github/workflows/publish_docker.yml +++ b/.github/workflows/publish_docker.yml @@ -24,7 +24,7 @@ jobs: with: registry: ghcr.io username: ${{ github.actor }} - password: ${{ secrets.GH_PAT }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image run: | From 138cf97fedaa7873ec8d973ac1c1914aa19ca019 Mon Sep 17 00:00:00 2001 From: EED85 Date: Mon, 28 Jul 2025 06:37:28 +0200 Subject: [PATCH 2/6] cleanup docker [no ci] --- .devcontainer/Dockerfile | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 07a3e39..4f44f92 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -14,18 +14,14 @@ LABEL org.opencontainers.image.licenses="MIT" # Install system packages: -# curl -RUN apt-get update && apt-get install -y curl -# gnupg -RUN apt-get update && apt-get install -y gnupg -# git -RUN apt-get update && apt-get install -y git -# unzip -RUN apt-get update && apt-get install -y unzip -# build-essential -RUN apt-get update && apt-get install -y build-essential -# libsqlite3-dev -RUN apt-get update && apt-get install -y libsqlite3-dev +RUN apt-get update && apt-get install -y \ + curl \ + gnupg \ + git \ + unzip \ + build-essential \ + libsqlite3-dev \ + && rm -rf /var/lib/apt/lists/* # duckdb RUN curl -sL https://install.duckdb.org | sh && \ mkdir -p /usr/local/bin && \ From 3e031d2afea7b540407c740d9f61dfe4b34e544f Mon Sep 17 00:00:00 2001 From: Eric Brahmann <37987769+EED85@users.noreply.github.com> Date: Mon, 28 Jul 2025 04:45:55 +0000 Subject: [PATCH 3/6] supress warning using uv [no ci] --- .devcontainer/devcontainer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 568b4f3..2421c83 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,6 +23,9 @@ "files.insertFinalNewline": true, "files.trimFinalNewlines": true, "files.autoSave": "afterDelay", + "terminal.integrated.env.linux": { + "UV_LINK_MODE": "copy" + } } } }, From 12fd6be8075e84af60be72e325879bf97c0e7bee Mon Sep 17 00:00:00 2001 From: EED85 Date: Mon, 28 Jul 2025 06:52:28 +0200 Subject: [PATCH 4/6] add git remote, if not set [no ci] --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2421c83..a52aa71 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -29,7 +29,7 @@ } } }, - "postCreateCommand": "uv venv --force && uv sync -v", + "postCreateCommand": "uv venv --force && uv sync -v && if ! git remote | grep origin; then repo=$(basename $(pwd)); git remote add origin https://github.com/EED-Solutions/$repo.git; fi", "features": {}, "remoteUser": "vscode" } From b66ad58e3eae53a5c9347f97ac9429a9e158a7e4 Mon Sep 17 00:00:00 2001 From: EED85 Date: Mon, 28 Jul 2025 07:01:15 +0200 Subject: [PATCH 5/6] build docker with tag versioning [no ci] --- .github/workflows/publish_docker.yml | 50 +++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish_docker.yml b/.github/workflows/publish_docker.yml index ddf5055..649cfbf 100644 --- a/.github/workflows/publish_docker.yml +++ b/.github/workflows/publish_docker.yml @@ -2,11 +2,13 @@ name: Publish Docker Image to GHCR on: workflow_dispatch: -# push: -# branches: [main] -# paths: -# - '.devcontainer/Dockerfile' -# - '.github/workflows/publish.yml' + push: + branches: + - main + - release + - dev + tags: + - 'v*.*.*' # Semantic versioning pattern permissions: contents: read @@ -28,6 +30,38 @@ jobs: - name: Build and push Docker image run: | - IMAGE_NAME=ghcr.io/eed-solutions/eed_docker_python_uv:latest - docker build -t $IMAGE_NAME -f .devcontainer/Dockerfile . - docker push $IMAGE_NAME + IMAGE_NAME=ghcr.io/eed-solutions/eed_docker_python_uv + TAG=latest + + # Determine tag based on context + if [[ "${{ github.ref_type }}" == "branch" ]]; then + case "${{ github.ref_name }}" in + "main") + TAG=main + ;; + "dev") + TAG=dev + ;; + "release") + TAG=release + ;; + *) + TAG=${{ github.ref_name }} + ;; + esac + elif [[ "${{ github.ref_type }}" == "tag" ]]; then + # For tags, use the tag name (should be semantic version like v1.0.0) + TAG=${{ github.ref_name }} + else + # Fallback + TAG=latest + fi + # Build and push the image + docker build -t $IMAGE_NAME:$TAG -f .devcontainer/Dockerfile . + docker push $IMAGE_NAME:$TAG + + # Push additional 'latest' tag for semantic version tags + if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then + docker tag $IMAGE_NAME:$TAG $IMAGE_NAME:latest + docker push $IMAGE_NAME:latest + fi From 83b399b68157ab3b01cd71b5d7869be2c427f4f0 Mon Sep 17 00:00:00 2001 From: EED85 Date: Mon, 28 Jul 2025 07:07:29 +0200 Subject: [PATCH 6/6] only build in sepecific changes [no ci] --- .github/workflows/publish_docker.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish_docker.yml b/.github/workflows/publish_docker.yml index 649cfbf..f2addf7 100644 --- a/.github/workflows/publish_docker.yml +++ b/.github/workflows/publish_docker.yml @@ -32,33 +32,41 @@ jobs: run: | IMAGE_NAME=ghcr.io/eed-solutions/eed_docker_python_uv TAG=latest + SHOULD_BUILD_PUSH=false - # Determine tag based on context - if [[ "${{ github.ref_type }}" == "branch" ]]; then + # Determine tag and build indicator based on context + if [[ "${{ github.ref_type }}" == "branch" ]]; then case "${{ github.ref_name }}" in "main") TAG=main + SHOULD_BUILD_PUSH=true ;; "dev") TAG=dev + SHOULD_BUILD_PUSH=true ;; "release") TAG=release + SHOULD_BUILD_PUSH=true ;; *) TAG=${{ github.ref_name }} ;; esac elif [[ "${{ github.ref_type }}" == "tag" ]]; then - # For tags, use the tag name (should be semantic version like v1.0.0) TAG=${{ github.ref_name }} + if [[ "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + SHOULD_BUILD_PUSH=true + fi + fi + + # Build and push the image if indicated + if [[ "$SHOULD_BUILD_PUSH" == "true" ]]; then + docker build -t $IMAGE_NAME:$TAG -f .devcontainer/Dockerfile . + docker push $IMAGE_NAME:$TAG else - # Fallback - TAG=latest + echo "Skipping build and push: not a main/dev/release branch or semantic version tag." fi - # Build and push the image - docker build -t $IMAGE_NAME:$TAG -f .devcontainer/Dockerfile . - docker push $IMAGE_NAME:$TAG # Push additional 'latest' tag for semantic version tags if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then