-
Notifications
You must be signed in to change notification settings - Fork 81
/
Dockerfile
74 lines (62 loc) · 2.69 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
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
ARG TEST_IMAGE=false
USER root
# install postgresql from centos if not building on RHSM system
RUN FULL_RHEL=$(microdnf repolist --enabled | grep rhel-8) ; \
if [ -z "$FULL_RHEL" ] ; then \
rpm -Uvh http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-8-4.el8.noarch.rpm \
http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-4.el8.noarch.rpm && \
sed -i 's/^\(enabled.*\)/\1\npriority=200/;' /etc/yum.repos.d/CentOS*.repo ; \
fi
ENV APP_ROOT=/opt/app-root/src
WORKDIR $APP_ROOT
RUN microdnf module enable postgresql:13 python39:3.9 && \
microdnf upgrade -y && \
microdnf install --setopt=tsflags=nodocs -y postgresql python39 rsync tar procps-ng make && \
rpm -qa | sort > packages-before-devel-install.txt && \
microdnf install --setopt=tsflags=nodocs -y libpq-devel python39-devel gcc && \
rpm -qa | sort > packages-after-devel-install.txt
COPY api/ api/
COPY app/ app/
COPY lib/ lib/
COPY migrations/ migrations/
COPY swagger/ swagger/
COPY tests/ tests/
COPY utils/ utils/
COPY Makefile Makefile
COPY gunicorn.conf.py gunicorn.conf.py
COPY host_reaper.py host_reaper.py
COPY host_synchronizer.py host_synchronizer.py
COPY inv_mq_service.py inv_mq_service.py
COPY inv_export_service.py inv_export_service.py
COPY logconfig.yaml logconfig.yaml
COPY manage.py manage.py
COPY pendo_syncher.py pendo_syncher.py
COPY Pipfile Pipfile
COPY Pipfile.lock Pipfile.lock
COPY pytest.ini pytest.ini
COPY rebuild_events_topic.py rebuild_events_topic.py
COPY run_gunicorn.py run_gunicorn.py
COPY run_command.sh run_command.sh
COPY run.py run.py
COPY system_profile_validator.py system_profile_validator.py
ENV PIP_NO_CACHE_DIR=1
ENV PIPENV_CLEAR=1
ENV PIPENV_VENV_IN_PROJECT=1
RUN python3 -m pip install --upgrade pip setuptools wheel && \
python3 -m pip install pipenv && \
python3 -m pip install dumb-init && \
pipenv install --system --dev
# allows pre-commit and unit tests to run successfully within the container if image is built in "test" environment
RUN if [ "$TEST_IMAGE" = "true" ]; then \
microdnf module enable nodejs:20 && \
microdnf install --setopt=tsflags=nodocs -y git npm which && \
chgrp -R 0 $APP_ROOT && \
chmod -R g=u $APP_ROOT ; \
fi
# remove devel packages that were only necessary for psycopg2 to compile
RUN microdnf remove -y $( comm -13 packages-before-devel-install.txt packages-after-devel-install.txt ) python39-setuptools && \
rm packages-before-devel-install.txt packages-after-devel-install.txt && \
microdnf clean all
USER 1001
ENTRYPOINT [ "dumb-init", "./run_command.sh" ]