Skip to content

Commit

Permalink
push to ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
Emterry committed Dec 4, 2024
1 parent 04abe7f commit d5d24e8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
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 }}
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions Makefile.local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit d5d24e8

Please sign in to comment.