-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Use a imagem base do Python | ||
FROM python:3.11 | ||
|
||
# Configuração do diretório de trabalho | ||
WORKDIR /mnt/code | ||
|
||
# Copie os arquivos de requisitos para o contêiner | ||
COPY requirements.txt . | ||
|
||
# Instale as dependências | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copie o código-fonte do Django para o contêiner | ||
COPY backend ./backend | ||
|
||
# Executar o servidor na inicialização do container e aguardar 3s para o db inicializar antes | ||
CMD ["sh", "-c", "sleep 3 && python manage.py runserver 0.0.0.0:8000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# In development | ||
|
||
## Application builded with Django, React and PostgreSQL | ||
|
||
## For local installation | ||
|
||
***In the backend directory, create a new vitual environment using venv*** | ||
|
||
python -m venv venv | ||
|
||
***Activate the environment*** | ||
|
||
source venv/bin/activate | ||
|
||
***Install the dependencies that django needs*** | ||
|
||
pip install -r ../requirements.txt | ||
|
||
## For dockerized installation | ||
|
||
***Create the environment variables in a file .env*** | ||
|
||
***Build the images and the containers*** | ||
|
||
docker compose build |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: '3.9' | ||
|
||
services: | ||
|
||
db: | ||
image: postgres:latest | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
POSTGRES_DB: ${POSTGRES_DB} | ||
POSTGRES_USER: ${POSTGRES_USER} | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
|
||
api: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "8000:8000" | ||
depends_on: | ||
- db | ||
env_file: | ||
- .env | ||
volumes: | ||
- ./backend:/mnt/code | ||
|
||
volumes: | ||
postgres_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters