-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile
88 lines (71 loc) · 1.6 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
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
ARG USER=that-user
ARG PASS=that-password
ARG HOST=%
ARG DB=uniauth
ARG COUNTRY=na
ARG STATE=na
ARG LOCATION=na
ARG ORGANIZATION=na
ARG ORGANIZATIONAL_UNIT=na
ARG COMMON_NAME=na
ARG VIRTUAL_ENV=/opt/venv
ARG PATH="$VIRTUAL_ENV/bin:$PATH"
FROM python:3.8-slim-buster as builder
RUN apt update
RUN apt install -y \
git \
xmlsec1 \
mariadb-server \
libmariadb-dev \
libssl-dev \
libmariadb-dev-compat \
libsasl2-dev \
libldap2-dev \
gcc
FROM builder as virtenv
RUN mkdir /app
WORKDIR /app
RUN pip install \
virtualenv \
django-sass-processor \
multildap \
ldap3 \
python-ldap \
design-django-theme \
django-unical-bootstrap-italia \
django-admin-rangefilter \
pycountry
ARG VIRTUAL_ENV
ENV VIRTUAL_ENV=$VIRTUAL_ENV
RUN python3 -m venv $VIRTUAL_ENV
ARG PATH
ENV PATH=$PATH
COPY ./src/requirements-dev.txt .
RUN pip install -r requirements-dev.txt
COPY src .
ARG USER
ENV USER=$USER
ARG PASS
ENV PASS=$PASS
ARG HOST
ENV HOST=$HOST
ARG DB
ENV DB=$DB
RUN service mysql restart \
&& mysql -u root -e "\
CREATE USER IF NOT EXISTS work@users-iMac.local IDENTIFIED BY ;\
CREATE DATABASE IF NOT EXISTS ${DB} CHARACTER SET = utf8 COLLATE = utf8_general_ci;\
GRANT ALL PRIVILEGES ON ${DB}.* TO work@users-iMac.local;"
ARG COUNTRY
ARG STATE
ARG LOCATION
ARG ORGANIZATION
ARG ORGANIZATIONAL_UNIT
ARG COMMON_NAME
RUN openssl \
req -nodes -new -x509 \
-newkey rsa:2048 \
-days 3650 \
-keyout certificates/private.key \
-out certificates/public.cert \
-subj "/C=$COUNTRY/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/OU=$ORGANIZATIONAL_UNIT/CN=$COMMON_NAME"