docker-compose builddocker-compose up -dYou can both build and start the up. This will also rebuild if the container is already existing, and you have made changes to the app
docker-compose up -d --build| # App port. Specifies port for appserver | |
| PORT=8000 |
docker-compose builddocker-compose up -dYou can both build and start the up. This will also rebuild if the container is already existing, and you have made changes to the app
docker-compose up -d --build| version: "3" | |
| services: | |
| ### Pythoon App Container ########################### | |
| web: | |
| build: | |
| context: ./ | |
| restart: unless-stopped | |
| command: "python manage.py runserver 0.0.0.0:8000" | |
| ports: | |
| - ${PORT}:8000 | |
| volumes: | |
| - .:/pos | |
| networks: | |
| - frontend | |
| ### Networks Setup ############################################ | |
| networks: | |
| frontend: | |
| driver: "bridge" |
| # Python support can be specified down to the minor or micro version | |
| # (e.g. 3.6 or 3.6.3). | |
| # OS Support also exists for jessie & stretch (slim and full). | |
| # See https://hub.docker.com/r/library/python/ for all supported Python | |
| # tags from Docker Hub. | |
| FROM python:3.11-bullseye | |
| # Here working directory is "/pos" because my django project is in "pos" folder. | |
| # Change this to match your project folder name | |
| WORKDIR /pos | |
| COPY requirements.txt /pos/ | |
| RUN apt-get -y install libpq-dev \ | |
| && apt-get clean | |
| # Using pip: | |
| RUN pip install -r requirements.txt |