diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f91c4741..6ab57c39 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,12 @@ jobs: runs-on: ubuntu-latest env: LOGS_BUCKET_NAME: moj-analytics-s3-logs + permissions: + actions: read + attestations: write + contents: write + id-token: write + packages: write steps: - name: Checkout uses: actions/checkout@v2 @@ -25,24 +31,27 @@ jobs: sudo curl -L "https://github.com/docker/compose/releases/download/v2.21.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose docker-compose --version - - # - name: Set up Docker Context for Buildx - # id: buildx-context - # run: docker context use builders || docker context create builders - - # - name: Set up Docker Buildx - # id: buildx - # uses: docker/setup-buildx-action@v1 - # with: - # version: latest - # endpoint: builders - name: Build image run: make build env: NETWORK: host + IMAGE_TAG: ${{ github.sha }} - name: Run Python tests (docker-compose) run: make clean && make test env: - NETWORK: default \ No newline at end of file + NETWORK: default + IMAGE_TAG: ${{ github.sha }} + + - name: Log in to GitHub Container Registry + id: ghcr_login + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push + run: | + docker push ghcr.io/${{ github.repository }}:${{ github.sha }} \ No newline at end of file diff --git a/Makefile b/Makefile index 6706965c..d8d4643b 100644 --- a/Makefile +++ b/Makefile @@ -30,21 +30,21 @@ test-python: test: test-python prepare-up: - @docker-compose up -d db - @docker-compose run --rm --no-deps frontend sh -c "do sleep 2;done" - @docker-compose up migration - @docker-compose run --rm --no-deps frontend sh -c "do sleep 2;done" + @docker compose up -d db + @docker compose run --rm --no-deps frontend sh -c "do sleep 2;done" + @docker compose up migration + @docker compose run --rm --no-deps frontend sh -c "do sleep 2;done" up: prepare-up - @docker-compose up -d frontend - @docker-compose logs -f + @docker compose up -d frontend + @docker compose logs -f enter: - docker-compose run --rm --no-deps --entrypoint sh worker + docker compose run --rm --no-deps --entrypoint sh worker logs: - @docker-compose logs -f + @docker compose logs -f push: - docker-compose push frontend + docker compose push frontend help: Makefile @echo diff --git a/Makefile.local.mk b/Makefile.local.mk index ffd8b60b..dc528081 100644 --- a/Makefile.local.mk +++ b/Makefile.local.mk @@ -2,15 +2,15 @@ all: help ## dev-prepare-up: Run migration before doing up dev-prepare-up: - docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml run migration + docker compose -f docker-compose.yaml -f docker-compose.dev.yaml run migration ## dev-daemon: Startup with docker process in background (to stop afterwards use make clean) dev-daemon: dev-prepare-up - docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml up -d frontend + docker compose -f docker-compose.yaml -f docker-compose.dev.yaml up -d frontend ## dev-fg: Startup with docker process in foreground dev-fg: dev-prepare-up - docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml up frontend + docker compose -f docker-compose.yaml -f docker-compose.dev.yaml up frontend ## dev-debug: Startup clean docker process in background, and docker attach to foreground for debugging dev-debug: clean dev-daemon @@ -22,15 +22,15 @@ dev-attach: ## dev-py: Start django shell (in the dev-packages context) in new container dev-py: - docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml run frontend sh -c "dev-packages/bin/python manage.py shell" + docker compose -f docker-compose.yaml -f docker-compose.dev.yaml run frontend sh -c "dev-packages/bin/python manage.py shell" ## dev-run: Start shell in new copy of container dev-run: - docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml run --rm frontend bash + docker compose -f docker-compose.yaml -f docker-compose.dev.yaml run --rm frontend bash ## dev-exec: Exec into shell of existing container dev-exec: - docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml exec frontend bash + docker compose -f docker-compose.yaml -f docker-compose.dev.yaml exec frontend bash test-wip: DJANGO_SETTINGS_MODULE=controlpanel.settings.test test-wip: