-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (26 loc) · 816 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
FROM python:3.11
ENV PROJECT_HOME=/app \
VIRTUAL_ENV=/opt/venv
# Set environment variables
# Prevents Python from writing pyc files to disc (equivalent to python -B option)
ENV PYTHONDONTWRITEBYTECODE 1
# Prevents Python from buffering stdout and stderr (equivalent to python -u option)
ENV PYTHONUNBUFFERED 1
# Prepare Python Environment:
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN python -m pip install --upgrade pip
RUN pip install wheel
WORKDIR ${PROJECT_HOME}
# Install dependencies:
COPY requirements.txt ${PROJECT_HOME}
RUN pip install --no-cache-dir -r requirements.txt
# Copy Source code:
COPY . ${PROJECT_HOME}
# Expose to the World:
EXPOSE 8000
# Ensure Persistence of Data:
VOLUME ["/app/files"]
# Run the application:
ENTRYPOINT [ "python" ]
CMD [ "server.py" ]