forked from spdx/spdx-online-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile.prod
62 lines (44 loc) · 1.79 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
# Using python3 as the base image
FROM python:3 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 musl-dev
# install psycopg2
RUN pip install psycopg2-binary==2.9.3
# 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 8
FROM openjdk:slim
# Copy complete python container into java container
COPY --from=production / /
# 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 /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf