Merge branch 'docker/improve-script' into 'master'

Docker/improve script

See merge request framasoft/mobilizon!275
This commit is contained in:
Thomas Citharel 2019-10-16 11:33:32 +02:00
commit c4204572c6
5 changed files with 16 additions and 4 deletions

View file

@ -7,4 +7,4 @@ RUN mix local.hex --force && mix local.rebar --force
WORKDIR /app WORKDIR /app
EXPOSE 4000 4001 4002 EXPOSE 4000

View file

@ -4,7 +4,12 @@ init:
start: stop start: stop
@bash docker/message.sh "starting Mobilizon with docker" @bash docker/message.sh "starting Mobilizon with docker"
docker-compose up -d docker-compose up -d api
docker-compose exec api sh -c "cd js && yarn install && cd ../"
docker-compose exec api mix deps.get
docker-compose exec api mix compile
docker-compose exec api mix ecto.create
docker-compose exec api mix ecto.migrate
@bash docker/message.sh "started" @bash docker/message.sh "started"
stop: stop:
@bash docker/message.sh "stopping Mobilizon" @bash docker/message.sh "stopping Mobilizon"

View file

@ -30,7 +30,7 @@ services:
MOBILIZON_DATABASE_USERNAME: postgres MOBILIZON_DATABASE_USERNAME: postgres
MOBILIZON_DATABASE_DBNAME: mobilizon_dev MOBILIZON_DATABASE_DBNAME: mobilizon_dev
MOBILIZON_DATABASE_HOST: postgres MOBILIZON_DATABASE_HOST: postgres
command: "mix phx.deps_migrate_serve" command: "mix phx.server"
volumes: volumes:
pgdata: pgdata:
.: .:

View file

@ -39,4 +39,4 @@ Just run :
```bash ```bash
make start make start
``` ```
to build and launch a database container and an API container running on localhost. to build and launch a database container and an API container running on `localhost:4000`.

View file

@ -9,6 +9,8 @@ To launch all the tests:
mix test mix test
``` ```
> If you're using Docker, you can use `make test`
If you want test coverage: If you want test coverage:
```bash ```bash
@ -41,6 +43,11 @@ Not done yet.
We use [Cypress](https://cypress.io) for End-to-end testing. We use [Cypress](https://cypress.io) for End-to-end testing.
You first need to run the webserver with the `e2e` environment: `MIX_ENV=e2e mix phx.server`. The same environment parameters as the `dev` environment must be provided.
This allows to run database operations in the sandbox and not pollute your database.
Then, run `MIX_ENV=e2e mix run priv/repo/e2e.seed.exs` to have some initial data inside your instance for the tests.
When inside the `js` directory, you can do either When inside the `js` directory, you can do either
```bash ```bash
npx cypress run npx cypress run