-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
33 lines (24 loc) · 957 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
FROM ubuntu:focal
RUN mkdir -p /var/www/blogit
WORKDIR /var/www/blogit
# Installs build/runtime dependencies
RUN apt-get update
RUN apt-get install -y gcc build-essential python3 python3-venv python3-dev
# Creates a virtual environment
RUN python3 -m venv .venv
# This enables production mode
ENV BLOGIT_MODE 1
# First we install dependencies so that whole cache isn't invalidated
COPY requirements.txt /var/www/blogit
RUN ["./.venv/bin/python" ,"-m" ,"pip", "install", "-r", "requirements.txt"]
# Delete build dependencies
RUN apt-get remove -y gcc build-essential python3-dev
RUN apt-get purge -y gcc build-essential python3-dev
RUN apt-get autoremove -y
RUN apt-get clean
# Remove cache
RUN rm -d -r ~/.cache
COPY . /var/www/blogit
# Create database tables
RUN ["./.venv/bin/python", "-m", "scripts.init_db"]
ENTRYPOINT [ "./.venv/bin/gunicorn", "--workers=2" ,"--worker-class=\"egg:meinheld#gunicorn_worker\"", "\"scripts.start:gunicorn()\"" ]