Skip to content

Commit

Permalink
Feature/ci/support multi platforms (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gkirito authored Oct 10, 2023
1 parent 6714070 commit 076e3bd
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 19 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,23 @@ jobs:
steps:
- uses: actions/checkout@master

- name: build code image
uses: elgohr/Publish-Docker-Github-Action@v4
- name: set up qemu
uses: docker/setup-qemu-action@v2

- name: set up docker buildx
uses: docker/setup-buildx-action@v2

- name: login to docker hub
uses: docker/login-action@v2
with:
name: ehco1996/django-sspanel
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest,code,${{ github.sha }}"
dockerfile: deploy/Dockerfile.CODE

- name: build code image
uses: docker/build-push-action@v4
with:
push: true
tags: "ehco1996/django-sspanel:latest,ehco1996/django-sspanel:code,ehco1996/django-sspanel:${{ github.sha }}"
platforms: linux/amd64,linux/arm64
file: deploy/Dockerfile.CODE

34 changes: 22 additions & 12 deletions .github/workflows/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,30 @@ jobs:
steps:
- uses: actions/checkout@master

- name: build runtime image
uses: elgohr/Publish-Docker-Github-Action@v4
- name: set up qemu
uses: docker/setup-qemu-action@v2

- name: set up docker buildx
uses: docker/setup-buildx-action@v2

- name: login to docker hub
uses: docker/login-action@v2
with:
name: ehco1996/django-sspanel
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "runtime"
dockerfile: deploy/Dockerfile.RUNTIME

- name: build nginx image
uses: elgohr/Publish-Docker-Github-Action@v4
- name: build & push runtime image
uses: docker/build-push-action@v4
with:
name: ehco1996/django-sspanel
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "nginx"
dockerfile: deploy/Dockerfile.NGINX
push: true
tags: ehco1996/django-sspanel:runtime
file: deploy/Dockerfile.RUNTIME
platforms: linux/amd64,linux/arm64

- name: build & push nginx image
uses: docker/build-push-action@v4
with:
push: true
tags: ehco1996/django-sspanel:nginx
file: deploy/Dockerfile.NGINX
platforms: linux/amd64,linux/arm64
6 changes: 4 additions & 2 deletions deploy/Dockerfile.RUNTIME
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ehco1996/django-sspanel:runtime as base
# FROM ehco1996/django-sspanel:runtime as base
# NOTE comment the before line and uncomment the next line only when bump python version
# FROM python:3.11-bullseye as base
FROM python:3.11-bullseye as base

LABEL Name=django-sspanel

Expand All @@ -11,3 +11,5 @@ RUN pip install --upgrade pip \
&& pip install --no-cache-dir poetry \
&& poetry config virtualenvs.create false \
&& poetry install --no-dev --no-interaction --no-ansi

ENV DJANGO_ENV=ci

0 comments on commit 076e3bd

Please sign in to comment.