1 | FROM ubuntu:22.04 |
---|
2 | ARG KOFA_VERSION=1.8.2.dev0 |
---|
3 | |
---|
4 | MAINTAINER Uli Fouquet <uli@waeup.org> |
---|
5 | |
---|
6 | ARG DEBIAN_FRONTEND=noninteractive |
---|
7 | RUN apt-get update && apt-get install -y tzdata |
---|
8 | RUN apt-get install -y apt-utils build-essential |
---|
9 | RUN apt-get install -y python2.7-dev libxml2-dev libxslt1-dev \ |
---|
10 | zlib1g-dev python3-virtualenv |
---|
11 | # see https://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl |
---|
12 | RUN apt-get install -y libssl-dev libffi-dev |
---|
13 | # libs needed/useful for Pillow image manipulations |
---|
14 | RUN apt-get install -y libjpeg-dev libfreetype6-dev libtiff-dev libopenjp2-7-dev |
---|
15 | # helpers not strictly necessary for running kofa but for setup and development |
---|
16 | RUN apt-get install -y sudo git wget pwgen xmlstarlet |
---|
17 | |
---|
18 | # add user `kofa` |
---|
19 | RUN useradd -ms /bin/bash kofa |
---|
20 | # set password of user `kofa` and add to group 'sudo' |
---|
21 | RUN echo kofa:kofa | chpasswd && adduser kofa sudo |
---|
22 | |
---|
23 | USER kofa |
---|
24 | ENV HOME /home/kofa |
---|
25 | WORKDIR /home/kofa |
---|
26 | |
---|
27 | # create a virtual env |
---|
28 | RUN virtualenv -p /usr/bin/python2.7 py27 |
---|
29 | |
---|
30 | # get sources |
---|
31 | |
---|
32 | ## We work with local kofa sources (create source packages with `python setup.py sdist`) |
---|
33 | COPY --chown=kofa:kofa dist/waeup.kofa-${KOFA_VERSION}.tar.gz /home/kofa |
---|
34 | COPY --chown=kofa:kofa dist/kofacustom.nigeria-1.3.dev0.tar.gz /home/kofa |
---|
35 | COPY --chown=kofa:kofa dist/waeup.aaue-1.2.dev0.tar.gz /home/kofa |
---|
36 | |
---|
37 | RUN tar -xzf waeup.aaue-1.2.dev0.tar.gz |
---|
38 | RUN rm waeup.aaue-1.2.dev0.tar.gz |
---|
39 | RUN mv waeup.aaue-1.2.dev0 waeup.aaue |
---|
40 | |
---|
41 | RUN mkdir waeup.aaue/sources |
---|
42 | |
---|
43 | RUN tar -xzf kofacustom.nigeria-1.3.dev0.tar.gz |
---|
44 | RUN rm kofacustom.nigeria-1.3.dev0.tar.gz |
---|
45 | RUN mv kofacustom.nigeria-1.3.dev0 waeup.aaue/sources/kofacustom.nigeria |
---|
46 | |
---|
47 | RUN tar -xzf waeup.kofa-${KOFA_VERSION}.tar.gz |
---|
48 | RUN rm waeup.kofa-${KOFA_VERSION}.tar.gz |
---|
49 | RUN mv waeup.kofa-${KOFA_VERSION} waeup.aaue/sources/waeup.kofa |
---|
50 | |
---|
51 | ## make sure, all added files belong to `kofa` |
---|
52 | #RUN chown -R kofa:kofa /home/kofa/ |
---|
53 | |
---|
54 | # install kofa -- this is the heavy part... |
---|
55 | WORKDIR /home/kofa/waeup.aaue |
---|
56 | |
---|
57 | # set random secrets for cookies |
---|
58 | RUN xmlstarlet edit -L -P -S -N x="http://namespaces.zope.org/browser" --update "//x:beakerSession/@secret" --value `pwgen -s -1 20` etc/site.zcml.in |
---|
59 | RUN xmlstarlet edit -L -P -S -N x="http://namespaces.zope.org/browser" --update "//x:beakerSession/@validate_key" --value "val_"`pwgen -s -1 16` etc/site.zcml.in |
---|
60 | |
---|
61 | # upgrade/pin down build helpers and run the build process |
---|
62 | RUN /home/kofa/py27/bin/pip install --upgrade pip zc.buildout |
---|
63 | RUN /home/kofa/py27/bin/pip install --upgrade --force-reinstall setuptools==44.1.1 |
---|
64 | |
---|
65 | RUN /home/kofa/py27/bin/buildout -c buildout-docker.cfg |
---|
66 | |
---|
67 | # this dir will contain data you might want to be persistent |
---|
68 | VOLUME ["/home/kofa/waeup.aaue/var/"] |
---|
69 | |
---|
70 | CMD /home/kofa/waeup.aaue/bin/kofactl fg |
---|