-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerComposefile
95 lines (81 loc) · 2.44 KB
/
DockerComposefile
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
FROM ubuntu:22.04 as build-image
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV APPLICATIONDIR=/core
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-dev \
python3-venv \
python3-pip \
python3-enchant \
build-essential \
default-libmysqlclient-dev \
libenchant-2-dev && \
rm -fr /var/lib/apt/lists && \
apt-get clean && \
apt-get autoremove && \
apt-get autoclean -y
RUN text -d ${APPLICATIONDIR} || mkdir -p ${APPLICATIONDIR}
ENV VIRTUAL_ENV=${APPLICATIONDIR}/venv
RUN python3 -m venv ${VIRTUAL_ENV}
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"
COPY requirements.txt .
RUN pip3 install -U pip
RUN pip3 install --no-cache-dir wheel
RUN pip3 install --no-cache-dir -r requirements.txt
RUN pip3 install debugpy
# Build runner image
FROM ubuntu:22.04 as runner-image
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV LOCALE=pt_BR.UTF-8
ENV LANG=${LOCALE}
ENV LANGUAGE=${LOCALE}
ENV LC_CTYPE=${LOCALE}
ENV LC_NUMERIC=${LOCALE}
ENV LC_TIME=${LOCALE}
ENV LC_COLLATE=${LOCALE}
ENV LC_MONETARY=${LOCALE}
ENV LC_MESSAGES=${LOCALE}
ENV LC_PAPER=${LOCALE}
ENV LC_NAME=${LOCALE}
ENV LC_ADDRESS=${LOCALE}
ENV LC_TELEPHONE=${LOCALE}
ENV LC_MEASUREMENT=${LOCALE}
ENV LC_IDENTIFICATION=${LOCALE}
ENV LC_ALL=C
ENV GUNICORNADDRESS=0.0.0.0
ENV GUNICORNPORT=8000
ENV CNAME=core
ENV APPLICATIONDIR=/core
ENV NEW_RELIC_CONFIG_FILE=${APPLICATIONDIR}/newrelic.ini
ENV SSL_CERT_DIR=/etc/ssl/certs
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
python3 \
python3-distutils \
default-libmysqlclient-dev \
libenchant-2-dev \
locales \
nginx && \
update-ca-certificates --fresh && \
rm -fr /var/lib/apt/lists && \
apt-get clean && \
apt-get autoremove && \
apt-get autoclean -y
# FIX LOCALE
RUN sed -i -e 's/# pt_BR.UTF-8 UTF-8/pt_BR.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=${LOCALE}
# NGINX
COPY nginx.conf /etc/nginx/sites-available/default
RUN text -d ${APPLICATIONDIR} || mkdir -p ${APPLICATIONDIR}
WORKDIR ${APPLICATIONDIR}
ENV VIRTUAL_ENV=/venv
RUN text -d ${VIRTUAL_ENV} || mkdir -p ${VIRTUAL_ENV}
COPY --from=build-image ${APPLICATIONDIR}${VIRTUAL_ENV} ${VIRTUAL_ENV}
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"