Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 2 #4

Merged
merged 3 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Use an official Python runtime as a parent image
# Use uma imagem oficial do Python como imagem mãe
FROM python:3.11-slim-bullseye

# Set the working directory in the container
# Define o diretório de trabalho no container
WORKDIR /usr/src/app

# Copy the current directory contents into the container at /usr/src/app
# Copia o conteúdo do diretório atual para o container em /usr/src/app
COPY prod_requirements.txt ./
COPY setup.py ./
COPY ./app ./app

# Install any needed packages specified in requirements.txt
# Instala os pacotes necessários especificados em requirements.txt
RUN pip install --no-cache-dir -r prod_requirements.txt

# Expose the port the app runs on
# Expõe a porta na qual o aplicativo é executado
EXPOSE 8000

# Define environment variable
# Define a variável de ambiente
ENV NAME PixzinhoBot

# Run app.py when the container launches
# Executa app.py quando o container é iniciado
CMD ["python", "setup.py"]
21 changes: 21 additions & 0 deletions app/services/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
from decouple import config
import termcolor
import os


# Caminho do arquivo .env
ENV_PATH = ".env"

# Verifica se o arquivo .env existe
if not os.path.exists(ENV_PATH):
with open(ENV_PATH, "w") as env_file:
# Escreve as variáveis padrões no arquivo
env_file.write("IP=127.0.0.1\n")
env_file.write("PORT=8000\n")
env_file.write("DATABASE_URL=sqlite:///./test.db\n")
print(termcolor.colored(
".env criado com valores padrão. Por favor, revise e ajuste conforme necessário.",
color="red",
attrs=["bold"]
)
)

IP = config("IP")
PORT = int(config("PORT"))
DATABASE_URL = config("DATABASE_URL")
Binary file modified prod_requirements.txt
Binary file not shown.
Binary file modified requirements.txt
Binary file not shown.
Loading