# A Docker Compose must always start with the version tag. # We use '3' because it's the last version. version: "3.8" # You should know that Docker Compose works with services. # 1 service = 1 container. # For example, a service, a server, a client, a database... # We use the keyword 'services' to start to create services. services: wine-db-api-v1: # service name container_name: wine-db-api-v1 build: ./app image: wine-db-api-v1 restart: unless-stopped environment: - TZ=Asia/Bangkok # network_mode: "app-network" # networks: # - backend ports: - 10205:8000 # volumes: # - ./mountvolume:/appfolder/mountvolume #privileged: true deploy: resources: limits: cpus: '2' # memory: 7200M # reservations: # devices: # - driver: nvidia # device_ids: ['2', '3'] # choose between device_ids or count # count: 1 # capabilities: [gpu] # # The name of our service is "database" # # but you can use the name of your choice. # # Note: This may change the commands you are going to use a little bit. # database: # # Official Postgres image from DockerHub (we use the last version) # image: 'postgres:latest' # # By default, a Postgres database is running on the 5432 port. # # If we want to access the database from our computer (outside the container), # # we must share the port with our computer's port. # # The syntax is [port we want on our machine]:[port we want to retrieve in the container] # # Note: You are free to change your computer's port, # # but take into consideration that it will change the way # # you are connecting to your database. # networks: # - backend # ports: # - 5432:5432 # environment: # POSTGRES_USER: username # The PostgreSQL user (useful to connect to the database) # POSTGRES_PASSWORD: password # The PostgreSQL password (useful to connect to the database) # volumes: # # In this example, we share the folder `db-data` in our root repository, with the default PostgreSQL data path. # # It means that every time the repository is modifying the data inside # # of `/var/lib/postgresql/data/`, automatically the change will appear in `db-data`. # # You don't need to create the `db-data` folder. Docker Compose will do it for you. # - ./data/db-data/:/var/lib/postgresql/data/ # networks: # default: # name: https-network # driver: bridge # external: true