We have one Dockerfile which consists of three stages:
- A Elixir app which compiles, fetches dependencies, ...
- A node.js app which compiles the assets. It uses libraries from the Elixir app.
- A production stage which copies the results from (1) and (2) and runs them.
In development we split the Dockerfile up into two separate containers (using
the target
directive) to continously re-compile the app and its assets.
Both containers share a volume with docker-sync to perfomantly access changed files as well as for the Elixir app to deliver the compiled assets.
Developers can mount more Containers into the stack with a custom docker-compose.user.yml
file.
It can look like this:
version: "3.4"
services:
adminer:
image: adminer
ports:
- 8080:8080
environment:
ADMINER_DEFAULT_SERVER: db
ADMINER_DESIGN: pepa-linha
Install:
- Docker
- Docker-Compose
- Run
bin/dev
, it will run the three containers specified below. You can access the website by visitinghttp://localhost:4000
. - Run
bin/seed
to seed the database.
After the initial start things might be wonky. Just restart the app and you should be fine. There are two cases where you need to interact with Docker directly:
- In some cases the containers won't stop after ctrl + c and keep running in the background (
docker ps
). If so you need to rundocker-compose down
manually. The same goes for the tests.
If you like you can run bin/test up
, which will start a separate stack which continuously runs tests agains a test database.
- Check for outdated deps with
bin/compose run app mix hex.outdated
and maybe change version constraints inmix.ex
. - Run
bin/compose run app mix deps.update --all
- Check app for errors before commiting
- Check for outdated deps with
bin/compose run assets yarn outdated
and maybe change version constraints inassets/package.json
. - Run
bin/compose run assets yarn upgrade
- Check app for errors before commiting
- Production URL: absolventenfeier.de
- GitHub builds containers for each commit. Master commits will be pushed to Docker Packages.
- Server listens with watchtower for changes and restarts app container.
Absolventenfeier
Copyright (C) 2020 Tobias Hoge
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.