Skip to content
Mateus Oliveira edited this page Jul 18, 2021 · 1 revision

To containerized the website code, the project uses Docker.

Project's Dockerfile and docker-compose configuration are stored in the docker folder, in the root directory.

To create the .env file, run

./scripts/env.sh

To start the development server, on host and port specified in .env file, run

docker-compose -f docker/docker-compose.yml --project-directory ./ up

Flag -f of file, to specify the path of docker-compose file.

Flag --project-directory, to specify the directory of the project. This configuration was needed on Mint, but seems unnecessary on Ubuntu. The problem occurs because .env file is not in the same directory of the compose file.

The difference between docker-compose files if docker-compose finds .env

version: '3.9'
services:
  service_name:
    build:
      context: ../
      dockerfile: ./docker/Dockerfile
    env_file: ../.env
    volumes:
      - type: bind
        source: ../file
        target: /working_dir/file
version: '3.9'
services:
  service_name:
    build:
      context: ./
      dockerfile: ./docker/Dockerfile
    volumes:
      - type: bind
        source: ./file
        target: /working_dir/file

For more information, check Docker CLI Options.

Clone this wiki locally