-
Notifications
You must be signed in to change notification settings - Fork 57
/
dockerfile.prod
64 lines (47 loc) · 1.96 KB
/
dockerfile.prod
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
# Using python3.10.13 as the base image
FROM python:3.10.13 as base
# Create the folder spdx and cd to it
WORKDIR /spdx
# Copy the requirements.txt file into the container
COPY requirements.txt .
# install psycopg2 dependencies
RUN apt-get update \
&& apt-get -y install libpq-dev gcc python-dev-is-python3 musl-dev
# install psycopg2
RUN pip install psycopg2-binary==2.9.9
# Install the python dependencies
RUN pip install -r requirements.txt
# -----------------------------
# Container for for SPDX Online tools
FROM base as production
# Setting current work directory to /spdx
WORKDIR /spdx
# Copy everthing into the container
COPY . .
# Install supervisor
RUN apt-get update && \
apt-get -y install supervisor && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
# Use JDK 11
ENV JAVA_HOME=/opt/java/openjdk
COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME
ENV PATH="${JAVA_HOME}/bin:${PATH}"
# Fetch the latest tagged licenses from Github for use in the Java license compares
RUN apt-get update \
&& apt-get -y install git
RUN mkdir /licenses && cd /licenses && git clone https://github.com/spdx/license-list-data.git --depth=1 && cd license-list-data && git fetch --tags && git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
RUN mkdir /licenses/current && cp /licenses/license-list-data/website/*.jsonld /licenses/current && cp /licenses/license-list-data/website/licenses.json /licenses/current && cp /licenses/license-list-data/website/exceptions.json /licenses/current
# Clean up apt lists
RUN rm -rf /var/lib/apt/lists/*
# Move to spdxonlinetools folder
WORKDIR /spdx
# Exposing ports where the server listens
EXPOSE 8000
# Move the configuration for supervisor to access
RUN mv ./supervisor_api.conf /etc/supervisor/conf.d
# Start the supervisor
CMD python src/manage.py migrate && \
python src/manage.py collectstatic --noinput && \
python src/populate.py && \
/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf