working dockerfile (#5)
Browse files- working dockerfile (f21a9c2d75f5f41af21b7779d225de6c8b8cfc40)
Co-authored-by: Harsh Vasudeva <[email protected]>
- Dockerfile +6 -22
Dockerfile
CHANGED
@@ -1,32 +1,16 @@
|
|
1 |
-
# Use the official Python 3.9 image
|
2 |
FROM python:3.9
|
3 |
-
|
4 |
-
# Set the working directory to /code
|
5 |
WORKDIR /code
|
|
|
|
|
|
|
6 |
|
7 |
-
# Copy the current directory contents into the container at /code
|
8 |
-
COPY . /code/
|
9 |
-
# COPY ./requirements.txt /code/requirements.txt
|
10 |
-
|
11 |
-
# Install requirements.txt
|
12 |
-
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
13 |
-
# pip install --no-cache-dir --upgrade --force-reinstall gunicorn
|
14 |
-
|
15 |
-
# Set up a new user named "user" with user ID 1000
|
16 |
RUN useradd -m -u 1000 user
|
17 |
-
# Switch to the "user" user
|
18 |
USER user
|
19 |
-
# Set home to the user's home directory
|
20 |
ENV HOME=/home/user \
|
21 |
PATH=/home/user/.local/bin:$PATH
|
22 |
-
|
23 |
-
# Set the working directory to the user's home directory
|
24 |
WORKDIR $HOME/app
|
25 |
-
|
26 |
-
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
27 |
COPY --chown=user . $HOME/app
|
28 |
-
|
29 |
EXPOSE 7755
|
30 |
-
|
31 |
-
|
32 |
-
CMD ["gunicorn","-k"," uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7755", "app:app"]
|
|
|
|
|
1 |
FROM python:3.9
|
|
|
|
|
2 |
WORKDIR /code
|
3 |
+
COPY . /code
|
4 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt \
|
5 |
+
pip install --no-cache-dir --upgrade --force-reinstall gunicorn
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
RUN useradd -m -u 1000 user
|
|
|
8 |
USER user
|
|
|
9 |
ENV HOME=/home/user \
|
10 |
PATH=/home/user/.local/bin:$PATH
|
11 |
+
|
|
|
12 |
WORKDIR $HOME/app
|
|
|
|
|
13 |
COPY --chown=user . $HOME/app
|
|
|
14 |
EXPOSE 7755
|
15 |
+
|
16 |
+
CMD ["gunicorn", "-b", "0.0.0.0:8000", "app:app"]
|
|