Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
5 changes: 4 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.autoSave": "afterDelay",
"terminal.integrated.env.linux": {
"UV_LINK_MODE": "copy"
}
}
}
},
"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"
}
60 changes: 51 additions & 9 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,10 +26,50 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT }}
password: ${{ secrets.GITHUB_TOKEN }}

- 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
SHOULD_BUILD_PUSH=false

# 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
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
echo "Skipping build and push: not a main/dev/release branch or semantic version tag."
fi

# 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