Make the Docker image "rootless" [WIP] #2827
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
name: Test suite | |
on: | |
pull_request: | |
push: | |
branches: [ main ] | |
jobs: | |
test: | |
name: Run test suite | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Caches | |
- name: Cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
var-cache-apt | |
var-lib-apt | |
root-.cache | |
key: cache-${{ hashFiles('Dockerfile') }} | |
- name: inject cache into docker | |
uses: reproducible-containers/[email protected] | |
with: | |
cache-map: | | |
{ | |
"var-cache-apt": "/var/cache/apt", | |
"var-lib-apt": "/var/lib/apt", | |
"root-.cache": "/root/.cache" | |
} | |
skip-extraction: ${{ steps.cache.outputs.cache-hit }} | |
- name: Create docker network | |
run: docker network create openhexa | |
- name: Copy .env file | |
run: cp .env.dist .env | |
- name: Build docker app image | |
env: | |
DOCKER_BUILDKIT: 1 | |
run: docker compose build --build-arg DJANGO_SETTINGS_MODULE="config.settings.dev" | |
- name: Run Django tests | |
run: docker compose run -e DEBUG=false app coveraged-test | |
- name: Setup upterm session | |
uses: lhotari/action-upterm@v1 | |
if: ${{ failure() }} | |
with: | |
## limits ssh access and adds the ssh public key for the user which triggered the workflow | |
# limit-access-to-actor: true | |
wait-timeout-minutes: 5 | |
# Push on main | |
- name: Build and push (on main) | |
uses: docker/build-push-action@v6 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
context: . | |
target: app | |
file: Dockerfile | |
build-args: | | |
DJANGO_SETTINGS_MODULE=config.settings.dev | |
cache-from: type=registry,ref=blsq/openhexa-app:buildcache | |
cache-to: type=registry,ref=blsq/openhexa-app:buildcache,mode=max | |
tags: | | |
blsq/openhexa-app:main | |
blsq/openhexa-app:latest | |