forked from RedHatInsights/vulnerability-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.test
49 lines (37 loc) · 1.72 KB
/
Dockerfile.test
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
FROM registry.access.redhat.com/ubi8/ubi-minimal
# 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
RUN microdnf module enable postgresql:15 && \
microdnf install --setopt=install_weak_deps=0 --setopt=tsflags=nodocs \
python38 python38-pip python38-devel libpq-devel gcc git postgresql-server which findutils diffutils && \
microdnf clean all
# missing pg_config, gcc, python3-devel needed for psycopg on aarch64
RUN [ "$(uname -m)" == "aarch64" ] && \
microdnf install --setopt=install_weak_deps=0 --setopt=tsflags=nodocs \
gcc-c++ && \
microdnf clean all || true
# for testing.posgres python package to find postgres commands
RUN ln -s /usr/bin/initdb /usr/local/bin/initdb && \
ln -s /usr/bin/postgres /usr/local/bin/postgres
RUN mkdir /engine && \
chown -R postgres:postgres /engine
WORKDIR /engine
ADD pyproject.toml /engine/
ADD poetry.lock /engine/
ENV LC_ALL=C.utf8
ENV LANG=C.utf8
RUN pip3 install --upgrade pip && \
pip3 install --upgrade poetry~=1.5
RUN poetry export --with dev -f requirements.txt --output requirements.txt && \
pip3 install -r requirements.txt
ADD . /engine
RUN chown -R postgres:postgres /engine
USER postgres
# config git, required by "test_upgrade"
RUN git config --global user.email "test@test" && \
git config --global user.name "test"