-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (23 loc) · 970 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
# syntax=docker/dockerfile:1
# Use an official Python runtime as a parent image
FROM python:slim-buster
# Add non-root user (To avoid pip install with root user)
RUN addgroup --system psiuser && adduser --system --group psiuser
# Set the user to psiuser
USER psiuser
# Set the working directory to /home/psiuser
WORKDIR /home/psiuser
# Copy all files into the container at /home/psiuser
COPY . /home/psiuser
# Add /home/psiuser/.local/bin to environment variables
ENV PATH=$PATH:/home/psiuser/.local/bin
# Install libraries
RUN pip install --user -U pip
RUN pip install --user --no-cache-dir -r requirements.txt
RUN pip install --user --no-cache-dir gunicorn Flask-Limiter[redis]==3.6.0
# Expose port 80 for gunicorn
EXPOSE 80/tcp
# Start the application with gunicorn with 4 workers
CMD [ "gunicorn", "-b", "0.0.0.0:80", "wsgi:app", "-w", "4" ]
# HEALTHCHECK for index page every 5 minutes
HEALTHCHECK --interval=5m CMD curl -f http://localhost:80/ || exit 1