-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/UniversitaDellaCalabria/u…
- Loading branch information
Showing
1 changed file
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
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 [email protected] IDENTIFIED BY ;\ | ||
CREATE DATABASE IF NOT EXISTS ${DB} CHARACTER SET = utf8 COLLATE = utf8_general_ci;\ | ||
GRANT ALL PRIVILEGES ON ${DB}.* TO [email protected];" | ||
|
||
|
||
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" | ||
|
||
|