Thebull commited on
Commit
4b49c1e
·
verified ·
1 Parent(s): f360066

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -12
Dockerfile CHANGED
@@ -1,17 +1,31 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.9-slim-buster
3
 
4
- # Set the working directory inside the container
5
- WORKDIR /app
6
 
7
- # Copy the current directory contents into the container at /app
8
- COPY . /app
9
 
10
- # Install any needed packages specified in requirements.txt
11
- RUN pip install --trusted-host pypi.python.org -r requirements.txt
12
 
13
- # Make port 80 available to the world outside this container
14
- EXPOSE 80
15
 
16
- # Run app.py when the container starts
17
- CMD ["python", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
 
2
 
3
+ WORKDIR /code
 
4
 
5
+ COPY ./requirements.txt /code/requirements.txt
 
6
 
7
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
8
 
9
+ RUN useradd -m -u 1000 user
 
10
 
11
+ USER user
12
+
13
+ ENV HOME=/home/user \
14
+ PATH=/home/user/.local/bin:$PATH
15
+
16
+ WORKDIR $HOME/app
17
+
18
+ # Agrega la siguiente línea al final del Dockerfile
19
+ ARG NO_CACHE=1
20
+
21
+ # Cambia la línea COPY por la siguiente:
22
+ COPY --from=builder --chown=user:user . $HOME/app
23
+
24
+ # Agrega el siguiente bloque al final del Dockerfile
25
+ RUN if [ "${NO_CACHE:-0}" -eq "1" ]; then echo "Installing dependencies without cache"; fi && pip install --no-cache-dir --upgrade -r /code/requirements.txt
26
+
27
+ # Agrega las siguientes líneas al final del Dockerfile
28
+ ARG USE_ENV_FILE=1
29
+ RUN if [ "${USE_ENV_FILE:-0}" -eq "1" ]; then cp /code/.env.local $HOME/app/.env; fi
30
+
31
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]