Skip to content

Commit

Permalink
Adapt build workflow and docs to compose v2
Browse files Browse the repository at this point in the history
  • Loading branch information
nezhar committed Sep 10, 2024
1 parent ccf7924 commit 0e4025f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Check if build and push is required
run: if docker-compose pull ${{ matrix.service }}; then echo "SKIP=1" >> $GITHUB_ENV; else echo "SKIP=0" >> $GITHUB_ENV; fi
run: if docker compose pull ${{ matrix.service }}; then echo "SKIP=1" >> $GITHUB_ENV; else echo "SKIP=0" >> $GITHUB_ENV; fi

- name: Build container image
run: docker-compose build ${{ matrix.service }}
run: docker compose build ${{ matrix.service }}
if: env.SKIP != 1

- name: Push container image
run: docker-compose push ${{ matrix.service }}
run: docker compose push ${{ matrix.service }}
if: env.SKIP != 1

- name: Dotenv Action
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
## Setup Application

* Create `docker-compose.override.yml` based on `docker-compose.override.example.yml` on adapt configuration
* Pull container images: `docker-compose pull`
* Start containers: `docker-compose up`
* Pull container images: `docker compose pull`
* Start containers: `docker compose up`

## Working with fixtures

Expand All @@ -13,15 +13,15 @@ Fixtures can be used in order to speed up the setup of the application.
### Creat a new fixture

```bash
docker-compose run --rm api python manage.py dumpdata --indent 4 --output /fixtures/setup.json --natural-foreign --natural-primary auth users shares snippets teams
docker compose run --rm api python manage.py dumpdata --indent 4 --output /fixtures/setup.json --natural-foreign --natural-primary auth users shares snippets teams
```

### Load existing fixture

The fixtures are located inside `data/fixtures` which is can be maped in the `docker-compose.override.yml`, ex: `./data/fixtures/:/fixtures/`.

```bash
docker-compose run --rm api python manage.py loaddata /fixtures/setup.json
docker compose run --rm api python manage.py loaddata /fixtures/setup.json
```

The current fixture available in the repository contains some dumy data, language configuration and an admin (Usernmae: `admin`, Password: `12345678!`)
Expand All @@ -32,9 +32,9 @@ The following steps are required:

* Create a override file based on the dev confgiuration: `cp docker-compose.override.dev.yml docker-compose.override.yml`
* Clone the code of the rest API: `git clone https://github.com/snypy/snypy-backend.git code/snypy-backend`
* Run docker compose: `docker-compose up`
* Run docker compose: `docker compose up`

The api container will load the code form the local volume and start the development server which reload on every change in the python files. All Django command can run via the container: `docker-compose exec api python manage.py makemigrations`
The api container will load the code form the local volume and start the development server which reload on every change in the python files. All Django command can run via the container: `docker compose exec api python manage.py makemigrations`

## Make the containers publicly avaialble

Expand Down Expand Up @@ -144,7 +144,7 @@ services:
Afterwards restart the containers and check the status
```bash
user@serverName:/snypy# docker-compose ps
user@serverName:/snypy# docker compose ps
Name Command State Ports
-----------------------------------------------------------------------------------------
snypy-docker_api_1 gunicorn --bind 0.0.0.0:80 ... Up 127.0.0.1:8000->8000/tcp
Expand Down

0 comments on commit 0e4025f

Please sign in to comment.