-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
44 lines (33 loc) · 1.07 KB
/
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
36
37
38
39
40
41
42
43
44
# Use an official Python runtime as a parent image
FROM python:3.10-bullseye
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Create a user to run your application
RUN groupadd -r myuser && useradd -r -g myuser myuser
# Set work directory
WORKDIR /code
# Install dependencies
RUN apt-get update && apt-get install -y default-libmysqlclient-dev \
build-essential \
gfortran \
libopenblas-dev \
liblapack-dev \
python3-dev
COPY requirements.txt /code/
COPY requirements-dev.txt /code/
RUN pip install --upgrade pip setuptools wheel
RUN pip install -r requirements-dev.txt
# Copy project
COPY . /code/
# Change ownership of the /code directory
RUN chown -R myuser:myuser /code
# Collect static files
RUN python tark/manage.py collectstatic --noinput
# Use the created user to run the application
USER myuser
# Expose port
EXPOSE 8000
# Run gunicorn as the container's main process
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--timeout", "120", "tark.wsgi:application"]
# CMD ["python", "tark/manage.py", "runserver", "0.0.0.0:8000"]