Skip to content

Commit

Permalink
Add GitHub Actions config to build 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
groovytron committed Nov 10, 2024
1 parent faf2ad1 commit c15f1b0
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 28 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build Images
on: [push]

jobs:
build:
name: Build image
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Get current date
id: date
run: echo "::set-output name=date::$(date -u +'%Y-%m-%dT%H:%m:%SZ')"
- name: Buildah Action
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: python
tags: 3.12 3.12-${{ github.sha }}
containerfiles: |
./3.12/Dockerfile
build-args: |
BUILD_DATE=${{ steps.date.outputs.date }}
VCS_REF=${{ github.sha }}
POETRY_VERSION=1.8.4
- name: Test the image
run: |
podman run \
-it \
--volume $(pwd):/var/www/app:rw \
--user dev \
localhost/python:3.12 \
bash ./test.sh
- name: Push To docker.io
id: push-to-dockerio
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: docker.io/groovytron
username: groovytron
password: ${{ secrets.REGISTRY_TOKEN }}

- name: Print image url
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
2 changes: 1 addition & 1 deletion 3.12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ RUN chown -R ${DEV_USER}:${DEV_USER} /home/${DEV_USER}/.config && chmod -R 775 /
USER dev

# Install Poetry
ENV PATH="/home/${DEV_USER}/.local/bin:$PATH"
ARG POETRY_VERSION
RUN pipx install poetry=="${POETRY_VERSION}"

ENV PATH="/home/${DEV_USER}/.local/bin:$PATH"

# Label schema related variables and metadata
ARG BUILD_DATE
Expand Down
43 changes: 16 additions & 27 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
#!/bin/bash

PROJECT_NAME=testsite
PIPENV_PROJECT_DIR=test_pipenv
POETRY_PROJECT_DIR=test_poetry

python --version
python3 --version
pip --version
pip3 --version
pipenv --version
poetry --version

# Create repository folders
mkdir -p "$PIPENV_PROJECT_DIR" "$POETRY_PROJECT_DIR"

# Pipenv test
cd "$PIPENV_PROJECT_DIR"

pipenv install django || exit 1
echo 'Creating test django project with pipenv...'

pipenv run django-admin startproject "$PROJECT_NAME" || exit 1
echo 'Django project created with pipenv.'

# Poetry test
cd "../$POETRY_PROJECT_DIR"

poetry init --no-interaction

poetry add Django || exit 1
echo 'Creating test django project using poetry...'

poetry run django-admin startproject "$PROJECT_NAME" || exit 1
echo 'Django project created with poetry.'
# PROJECT_NAME=testsite
# POETRY_PROJECT_DIR=test_poetry
#
# # Create repository folders
# mkdir -p "$POETRY_PROJECT_DIR"
#
# # Poetry test
# cd "$POETRY_PROJECT_DIR" || exit 1
#
# poetry init --no-interaction
#
# poetry add Django || exit 1
# echo 'Creating test django project using poetry...'
#
# poetry run django-admin startproject "$PROJECT_NAME" || exit 1
# echo 'Django project created with poetry.'

0 comments on commit c15f1b0

Please sign in to comment.