-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
79 lines (66 loc) · 3.16 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
FROM alpine:3.14
ARG version
SHELL ["/bin/sh", "-euxo", "pipefail", "-c"]
WORKDIR /oxp
CMD ["/sbin/init"]
LABEL "description"="UCS OX provisioning app" \
"version"="$version"
# package and Python dependency installation, base system configuration,
# and uninstallation - all in one step to keep image small
COPY alpine_apk_list.* requirements_all.txt /tmp/
RUN apk add --no-cache $(cat /tmp/alpine_apk_list.build) $(cat /tmp/alpine_apk_list.runtime) && \
cp -v /usr/share/zoneinfo/Europe/Berlin /etc/localtime && \
echo "Europe/Berlin" > /etc/timezone && \
pip3 install --no-cache-dir --compile --upgrade pip && \
pip3 install --no-cache-dir --compile --upgrade -r /tmp/requirements_all.txt && \
apk del --no-cache $(cat /tmp/alpine_apk_list.build) && \
python3 -c "from zeep import Client" && \
rm -rf /tmp/*
COPY univention-ox-soap-api/ /tmp/univention-ox-soap-api/
RUN export OX_PROVISIONING_VERSION="$version" &&\
pip3 install --no-cache-dir --compile --upgrade /tmp/univention-ox-soap-api && \
python3 -c "from univention.ox.soap.services import get_ox_soap_service_class" && \
python3 -c "from univention.ox.soap.backend_base import get_ox_integration_class" && \
rm -rf /tmp/*
COPY univention-ox-provisioning /tmp/univention-ox-provisioning
COPY Makefile /tmp
COPY app/listener_trigger /tmp/app/
COPY tests /tmp/tests
COPY LICENSE /usr/local/share/ox-connector/LICENSE
# 1st linting, then installation
RUN apk add --no-cache gcc python3-dev make musl-dev && \
python3 -m venv --system-site-packages /tmp/venv && \
. /tmp/venv/bin/activate && \
pip3 install --no-cache-dir --compile -U pip && \
pip3 install --no-cache-dir --compile black flake8 isort && \
cd /tmp && \
#make lint && \
#echo "Linting OK." && \
# deactivate() is not installed in 'ash' shell, manually deactivate virtualenv:
export PATH="${_OLD_VIRTUAL_PATH:-}" && \
export PS1="${_OLD_VIRTUAL_PS1:-}" && \
# setup.py will read app version from environment
export OX_PROVISIONING_VERSION="$version" && \
pip3 install --no-cache-dir --compile /tmp/univention-ox-provisioning && \
python3 -c "from univention.ox.provisioning import run" && \
apk del --no-cache gcc python3-dev make musl-dev && \
rm -rf /tmp/*
COPY app/listener_trigger /usr/local/share/ox-connector/listener_trigger
COPY share/ /usr/local/share/ox-connector/resources
COPY udm/ /usr/local/share/ox-connector/resources/udm
COPY umc/ /usr/local/share/ox-connector/resources/umc
COPY ldap/ /usr/local/share/ox-connector/resources/ldap
COPY bin/* /usr/local/bin/
#
# comment below out for final image
#
RUN apk add --no-cache vim
RUN apk add --no-cache py3-multidict py3-yarl && \
pip3 install --no-cache-dir --compile udm-rest-client && \
pip3 install --no-cache-dir --compile --index-url https://test.pypi.org/simple/ openapi-client-udm-ox && \
python3 -c "from udm_rest_client.udm import UDM" && \
python3 -c "import openapi_client_udm; openapi_client_udm.OxmailOxcontext.dn"
COPY univention-ox-provisioning/requirements_tests.txt tests/ /oxp/tests/
RUN pip3 install --no-cache-dir --compile --upgrade -r /oxp/tests/requirements_tests.txt && \
python3 -m pytest --collect-only /oxp/tests && \
rm -rf /oxp/.pytest_cache /oxp/tests/requirements_tests.txt