This repository has been archived by the owner on Nov 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContainerfile
70 lines (56 loc) · 2.27 KB
/
Containerfile
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
ARG PYTHON_VERSION=3.9
FROM python:${PYTHON_VERSION}
ARG VERSION=latest
ENV TZ=UTC
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait
COPY files/local_settings.py /etc/patchman/local_settings.py
COPY files/requirements.txt /requirements.txt
COPY files/run.sh /run.sh
COPY files/fixtures.json /fixtures.json
COPY files/pman-upd.patch /pman-upd.patch
# hadolint ignore=DL3018
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
curl \
git \
python3-apt \
python3-dev \
&& apt-get clean \
&& apt-get autoremove -y \
&& mkdir /configuration \
&& rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
&& chmod +x /wait
RUN if [ $VERSION = "latest" ]; then git clone https://github.com/furlongm/patchman.git /repository; fi \
&& if [ $VERSION != "latest" ]; then git clone -b v$VERSION https://github.com/furlongm/patchman.git /repository; fi
# TODO(osfrickler): Drop patch once it has been merged upstream
RUN patch -d /repository -p1 -i /pman-upd.patch
# hadolint ignore=DL3013
RUN pip3 install --no-cache-dir --upgrade pip \
&& pip3 install --no-cache-dir -r /repository/requirements.txt \
&& pip3 install --no-cache-dir -r /requirements.txt \
&& pip3 install --no-cache-dir /repository \
&& ln -s /usr/lib/python3/dist-packages/*apt* /usr/local/lib/python3.9/site-packages
RUN useradd patchman \
&& chown patchman: /etc/patchman/local_settings.py \
&& mkdir -p /var/lib/patchman/db \
&& lib=$(python3 -c "import site; print(site.getsitepackages()[0])") \
&& mkdir -p "$lib/run/static" \
&& chown -R patchman: /var/lib/patchman "$lib/run/static"
RUN apt-get remove -y \
git \
python3-dev \
&& rm -rf /repository /requirements.txt
USER patchman
WORKDIR /
EXPOSE 8000
CMD ["sh", "-c", "/wait && /run.sh"]
HEALTHCHECK CMD curl --fail http://localhost:8000 || exit 1
LABEL "org.opencontainers.image.documentation"="https://docs.osism.tech" \
"org.opencontainers.image.licenses"="ASL 2.0" \
"org.opencontainers.image.source"="https://github.com/osism/container-image-patchman" \
"org.opencontainers.image.url"="https://www.osism.tech" \
"org.opencontainers.image.vendor"="OSISM GmbH"