|
|
|
@ -1,49 +1,39 @@ |
|
|
|
|
# NOTE: Use the run-container.sh script to build and launch this container. |
|
|
|
|
|
|
|
|
|
# NOTE: Multi-stage builds require Docker >= 17.05. |
|
|
|
|
FROM centos:8 AS base |
|
|
|
|
|
|
|
|
|
# update packages |
|
|
|
|
RUN dnf -y upgrade-minimal |
|
|
|
|
# update packages and install requirements |
|
|
|
|
RUN dnf -y upgrade-minimal && \ |
|
|
|
|
dnf install -y python38 && \ |
|
|
|
|
dnf install -y ghostscript && \ |
|
|
|
|
dnf clean all |
|
|
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
|
|
|
|
|
|
|
|
FROM base AS build |
|
|
|
|
|
|
|
|
|
# install Python |
|
|
|
|
# NOTE: The version of Python we want is newer than what's in Centos 8, |
|
|
|
|
# so we have to install from source :-/ |
|
|
|
|
RUN dnf -y groupinstall "Development Tools" && \ |
|
|
|
|
dnf -y install openssl-devel bzip2-devel libffi-devel sqlite-devel |
|
|
|
|
RUN cd /tmp && \ |
|
|
|
|
dnf -y install wget && \ |
|
|
|
|
wget https://www.python.org/ftp/python/3.8.7/Python-3.8.7.tgz && \ |
|
|
|
|
tar xvf Python-3.8.7.tgz && \ |
|
|
|
|
cd Python-3.8.7/ && \ |
|
|
|
|
./configure --enable-optimizations && \ |
|
|
|
|
make install |
|
|
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
|
|
|
|
|
|
|
|
FROM base |
|
|
|
|
|
|
|
|
|
# copy the Python installation from the build image |
|
|
|
|
COPY --from=build /usr/local/bin/python3.8 /usr/local/bin/python3.8 |
|
|
|
|
COPY --from=build /usr/local/lib/python3.8 /usr/local/lib/python3.8 |
|
|
|
|
COPY --from=build /usr/local/bin/pip3 /usr/local/bin/pip3 |
|
|
|
|
RUN ln -s /usr/local/bin/python3.8 /usr/local/bin/python3 |
|
|
|
|
|
|
|
|
|
# install requirements |
|
|
|
|
RUN dnf -y install ghostscript && \ |
|
|
|
|
dnf clean all |
|
|
|
|
# set up a virtualenv |
|
|
|
|
RUN python3 -m venv /opt/venv |
|
|
|
|
ENV PATH="/opt/venv/bin:$PATH" |
|
|
|
|
RUN pip install --upgrade pip |
|
|
|
|
|
|
|
|
|
# install the application requirements |
|
|
|
|
COPY requirements.txt requirements-dev.txt ./ |
|
|
|
|
RUN pip3 install -r requirements.txt |
|
|
|
|
COPY requirements.txt requirements-dev.txt /tmp/ |
|
|
|
|
RUN pip3 install -r /tmp/requirements.txt |
|
|
|
|
ARG CONTROL_TESTS_PORT |
|
|
|
|
RUN if [ -n "$CONTROL_TESTS_PORT" ]; then \ |
|
|
|
|
pip3 install -r requirements-dev.txt \ |
|
|
|
|
pip3 install -r /tmp/requirements-dev.txt \ |
|
|
|
|
; fi |
|
|
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
|
|
|
|
|
|
|
|
FROM base |
|
|
|
|
|
|
|
|
|
# copy the virtualenv from the build image |
|
|
|
|
COPY --from=build /opt/venv /opt/venv |
|
|
|
|
ENV PATH="/opt/venv/bin:$PATH" |
|
|
|
|
|
|
|
|
|
# install the application |
|
|
|
|
WORKDIR /app |
|
|
|
|
COPY asl_rulebook2/ ./asl_rulebook2/ |
|
|
|
|