Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@ ENV TZ=Europe/Madrid \
DJANGO_SUPERUSER_USERNAME=scim \
DJANGO_SUPERUSER_EMAIL=scim@ipa.test

# Copy the source code
RUN mkdir /www
COPY . /www/ipa-tuura

# Install system dependencies
RUN dnf -y update && dnf -y install \
dbus-daemon \
dbus-devel \
gcc \
glib2-devel \
git \
glibc \
httpd \
krb5-devel \
Expand All @@ -43,6 +40,10 @@ RUN dnf -y update && dnf -y install \
unzip \
&& dnf clean all

# Copy the source code
WORKDIR /www
RUN git clone https://github.com/freeipa/ipa-tuura ipa-tuura

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turn the URL into an ARG SOURCE_URL=https://github.com/freeipa/ipa-tuura and then do

ARG SOURCE_URL=../ipa-tuura
ARG SOURCE_CMD=cp -pr
RUN ${SOURCE_CMD} ${SOURCE_URL} ipa-tuura

for local runs where we copy things locally, just don't pass anything or pass the full path with podman-build --build-arg=SOURCE_URL=$(pwd), for cloning remotely use podman-build --build-arg=SOURCE_URL=https://github.com/freeipa/ipa-tuura --build-arg=SOURCE_CMD="git clone".

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or these arguments can be put into a file and then build args file can be specified with podman-build --build-arg-file clone-from-github.args:

$ cat clone-from-github.args
SOURCE_URL=https://github.com/freeipa/ipa-tuura
SOURCE_CMD=git clone
$ podman-build --build-arg-file=./clone-from-github.args ...

We can also turn the defaults around and have local copying be a custom version.


# Install ipa-tuura dependencies
RUN dnf -y update && dnf -y install \
openldap-clients \
Expand All @@ -60,6 +61,9 @@ RUN dnf -y update && dnf -y install \
&& dnf clean all \
&& pip install -r /www/ipa-tuura/src/install/requirements.txt

RUN ls /www
RUN ls /www/ipa-tuura

# Django setup
WORKDIR /www/ipa-tuura/src/ipa-tuura/
RUN python3 manage.py makemigrations \
Expand All @@ -69,13 +73,13 @@ RUN python3 manage.py makemigrations \
&& sed -i 's/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \['"'*'"'\]/g' /www/ipa-tuura/src/ipa-tuura/root/settings.py

# Generate and configure self-signed certificate
COPY conf/ipa.conf /root
RUN cp /www/ipa-tuura/conf/ipa.conf /root
RUN openssl req -config /root/ipa.conf -newkey rsa -x509 -days 365 -out /etc/pki/tls/certs/apache-selfsigned.crt \
&& sed -i 's\localhost.crt\apache-selfsigned.crt\g' /etc/httpd/conf.d/ssl.conf \
&& sed -i 's\localhost.key\apache-selfsigned.key\g' /etc/httpd/conf.d/ssl.conf

# Deploy Apache virtual host
COPY conf/ipatuura.conf /etc/httpd/conf.d/ipatuura.conf
RUN cp /www/ipa-tuura/conf/ipatuura.conf /etc/httpd/conf.d/ipatuura.conf

# Setup permissions for apache user
RUN echo 'apache ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/apache \
Expand All @@ -86,8 +90,10 @@ RUN echo 'apache ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/apache \
&& chown apache:apache /www/ipa-tuura/src/ipa-tuura/db.sqlite3

# Setup gssproxy
COPY conf/gssproxy.conf /etc/gssproxy/80-httpd.conf
COPY conf/httpd_env.conf /etc/systemd/system/httpd.service.d/env.conf
RUN mkdir -m 0755 -p /etc/gssproxy \
&& cp /www/ipa-tuura/conf/gssproxy.conf /etc/gssproxy/80-httpd.conf
RUN mkdir -m 0755 -p /etc/systemd/system/httpd.service.d \
&& cp /www/ipa-tuura/conf/httpd_env.conf /etc/systemd/system/httpd.service.d/env.conf
RUN mkdir /var/lib/ipatuura \
&& chmod 770 /var/lib/ipatuura \
&& systemctl enable gssproxy
Expand Down