Spaces:
No application file
No application file
Commit
·
8112d2c
1
Parent(s):
bf7aaba
Dockerfile para Flask e FastAPI
Browse files
1_Building_a_Python_Weather_App_using_Docker_and_Cloud_Run/Dockerfile
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use a imagem oficial do Python como imagem base:
|
2 |
+
FROM python:3.8-slim
|
3 |
+
|
4 |
+
# Defina o diretório de trabalho no contêiner:
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Copie o arquivo requisitos.txt para o contêiner:
|
8 |
+
COPY requirements.txt .
|
9 |
+
|
10 |
+
# Instale as dependências necessárias:
|
11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
+
# Instalando uvicorn:
|
13 |
+
#RUN pip install uvicorn
|
14 |
+
RUN pip install python-multipart
|
15 |
+
|
16 |
+
# Copie os arquivos do aplicativo FastAPI para o contêiner:
|
17 |
+
COPY . .
|
18 |
+
|
19 |
+
# Exponha a porta em que o aplicativo será executado:
|
20 |
+
EXPOSE 8080
|
21 |
+
|
22 |
+
# Defina o comando para executar seu aplicativo:
|
23 |
+
CMD ["uvicorn", "app_FastAPI:app", "--host", "0.0.0.0", "--port", "8080"]
|
1_Building_a_Python_Weather_App_using_Docker_and_Cloud_Run/Dockerfile_Flask
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use a imagem oficial do Python como imagem base:
|
2 |
+
FROM python:3.8-slim
|
3 |
+
|
4 |
+
# Set the working directory in the container
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy the requirements.txt file into the container
|
8 |
+
COPY requirements.txt .
|
9 |
+
|
10 |
+
# Install the required dependencies
|
11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
+
|
13 |
+
# Copy the Flask app files into the container
|
14 |
+
COPY . .
|
15 |
+
|
16 |
+
# Expose the port that the app will run on
|
17 |
+
EXPOSE 8080
|
18 |
+
|
19 |
+
# Define the command to run your application
|
20 |
+
CMD ["python", "app.py"]
|