-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Jake Wagoner <jakewagoneredu@gmail.com>
- Loading branch information
Showing
6 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# This file builds the Docker image and pushes it to ghcr.io | ||
# It is triggered on every release | ||
# The build will run for multiple platforms (amd64, arm64, armv7) | ||
# The build will run on multiple LTS versions of Django (3.2, 4.2) | ||
# The build will run on multiple versions of Python (3.8, 3.9, 3.10), which will be configured in the matrix and pinned to the LTS versions of Django | ||
|
||
name: Build Image | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build-matrix: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
software-versions: [ | ||
{"python-version": 3.9, "django-version": 3.2}, | ||
{"python-version": 3.12, "django-version": 4.2} | ||
] | ||
platform: [amd64, arm64] | ||
poetry-version: [1.7] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Copy from django${{ matrix.software-versions.django-version }} directory to root | ||
run: cp -r django${{ matrix.software-versions.django-version }}/* . | ||
|
||
- name: Replace Python Version in Dockerfile | ||
run: sed -i "s/PYTHON_VERSION/${{ matrix.software-versions.python-version }}/g" Dockerfile | ||
|
||
- name: Replace the Django Version in Dockerfile | ||
run: sed -i "s/DJANGO_VERSION/${{ matrix.software-versions.django-version }}/g" Dockerfile | ||
|
||
- name: Build the image | ||
run: docker buildx build --platform linux/${{ matrix.platform }} --push -t ghcr.io/visdesignlab/django-image:${{matrix.software-versions.django-version}}-${{ github.ref_name }} . | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM python:PYTHON_VERSION-slim | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends build-essential libpq-dev python3-dev default-libmysqlclient-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY ./djangoDJANGO_VERSION/* /install/ | ||
WORKDIR /install | ||
|
||
RUN pip3 install poetry | ||
RUN poetry install | ||
|
||
VOLUME /app | ||
WORKDIR /app | ||
|
||
COPY ./entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
VOLUME /app | ||
WORKDIR /app | ||
|
||
EXPOSE 8000 | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
# django-image | ||
# django-image | ||
|
||
Django container: | ||
GHCR | ||
2 Major versions of Django at once | ||
Each major version of Django will be pinned to a python version | ||
Image needs to allow installing additional dependencies inside of it for each project, but should come with a comprehensive django base (CORS, mysql, pgsql, oauth package, poetry, gunicorn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[tool.poetry] | ||
name = "django32" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Your Name <you@example.com>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.9" | ||
django = ">=3.2,<4.0" | ||
|
||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[tool.poetry] | ||
name = "django42" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Your Name <you@example.com>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.12" | ||
django = ">=4.2,<5.0" | ||
|
||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#! /bin/bash | ||
|
||
echo 'entrypoint.sh' | ||
echo `pwd` |