Skip to content

Build Base Image

Docker

Installation

We use the docker compose (not docker-compose) to run the project in containers, please pre-install Docker Engine or Docker Desktop before getting started.

Build the base image

Build the base image for local development.

docker build -t coscupweb-base:22.11.27 -f ./Dockerfile-base-dev ./

Note

We've not registed the coscupweb-base on Docker Hub, therefor you need to build this image manually. In this way, you haven't needed to signup the Docker Hub account.

setting.py

Setup the setting.py

cp setting_sample.py setting.py

Edit the setting.py, make MONGO_MOCK to be False.

Todo

At this section, just only setting up the MONGO_MOCK, the rest of settings please read this section of about setting.py.

Compose up

Build the rest of app images

docker compose build --no-cache

Or directly execute up to build and run ...

docker compose up --build

Wait an amount until all services are available, open browser and visit to:

http://127.0.0.1:80/

Warning

Because of the cookie with secure attributes (__Host-) at local in 127.0.0.1 is not allowed for Chrome and Safari (Issue 1056543, Issue 1263426), the following steps are works only in Firefox.

Tip

For more information about the Compose file, see the Compose file reference.

Create first user account

To create a user for dev.

docker compose run --rm cmdapp dev user_add

docs_add_users

If succeed, the command will display the message like below:

[!] Next step
 | Please visit one of these links to setup the cookie/session:
    -> http://127.0.0.1/dev/cookie?sid={sid}

Open browser visit one of those links to:

http://127.0.0.1/dev/cookie?sid={sid}

Info

This command will create 10 user accounts and the register sessions, so you need to feed the cookie for your browser.


Last update: November 26, 2022