parent
b22c714ec5
commit
c92f24d9b0
@ -1,65 +1,57 @@ |
|||||||
# NOTE: Use the run-container.sh script to build and launch this container. |
# NOTE: Use the run-container.sh script to build and launch this container. |
||||||
|
|
||||||
# We do a multi-stage build (requires Docker >= 17.05) to install everything, then copy it all |
FROM centos:8 |
||||||
# to the final target image. |
|
||||||
|
|
||||||
FROM centos:8 AS base |
# update packages |
||||||
|
RUN dnf -y upgrade-minimal |
||||||
|
|
||||||
# update packages and install Python and Java |
# install Python |
||||||
RUN dnf -y upgrade-minimal && \ |
RUN dnf install -y python36 |
||||||
dnf install -y python36 && \ |
|
||||||
curl -s "https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_linux-x64_bin.tar.gz" | tar -C /usr/bin/ -xz && \ |
|
||||||
dnf clean all |
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
# install Java |
||||||
|
RUN curl -s "https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_linux-x64_bin.tar.gz" \ |
||||||
FROM base AS build |
| tar -C /usr/bin/ -xz |
||||||
|
|
||||||
# set up a virtualenv |
|
||||||
RUN python3.6 -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 pip install -r requirements.txt |
|
||||||
ARG ENABLE_TESTS |
|
||||||
RUN if [ "$ENABLE_TESTS" ]; then pip install -r 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 Firefox |
# install Firefox |
||||||
RUN dnf install -y wget bzip2 xorg-x11-server-Xvfb gtk3 dbus-glib |
RUN dnf install -y wget bzip2 xorg-x11-server-Xvfb gtk3 dbus-glib && \ |
||||||
RUN wget -qO- "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US" | tar -C /usr/local/ -jx && \ |
wget -qO- "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US" \ |
||||||
|
| tar -C /usr/local/ -jx && \ |
||||||
ln -s /usr/local/firefox/firefox /usr/bin/firefox && \ |
ln -s /usr/local/firefox/firefox /usr/bin/firefox && \ |
||||||
echo "exclude=firefox" >> /etc/dnf/dnf.conf |
echo "exclude=firefox" >>/etc/dnf/dnf.conf |
||||||
|
|
||||||
# install geckodriver |
# install geckodriver |
||||||
RUN url=$( curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | grep -Poh 'https.*linux64\.tar\.gz(?!\.)' ) && \ |
RUN url=$( curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | grep -Poh 'https.*linux64\.tar\.gz(?!\.)' ) && \ |
||||||
curl -sL "$url" | tar -C /usr/bin/ -xz |
curl -sL "$url" \ |
||||||
|
| tar -C /usr/bin/ -xz |
||||||
|
|
||||||
# install the application |
# clean up |
||||||
WORKDIR /app |
RUN dnf clean all |
||||||
COPY vasl_templates vasl_templates |
|
||||||
COPY vassal-shim/release/vassal-shim.jar vassal-shim/release/ |
|
||||||
COPY setup.py requirements.txt requirements-dev.txt LICENSE.txt ./ |
|
||||||
RUN pip install -e . |
|
||||||
|
|
||||||
# copy the config files |
# install the application requirements |
||||||
COPY docker/config/* vasl_templates/webapp/config/ |
WORKDIR /app |
||||||
|
COPY requirements.txt requirements-dev.txt ./ |
||||||
|
RUN pip3 install -r requirements.txt |
||||||
ARG ENABLE_TESTS |
ARG ENABLE_TESTS |
||||||
RUN if [ "$ENABLE_TESTS" ]; then echo "ENABLE_REMOTE_TEST_CONTROL = 1" >>vasl_templates/webapp/config/debug.cfg ; fi |
RUN if [ "$ENABLE_TESTS" ]; then \ |
||||||
|
pip3 install -r requirements-dev.txt \ |
||||||
|
; fi |
||||||
|
|
||||||
|
# install the application |
||||||
|
COPY vasl_templates/webapp/ ./vasl_templates/webapp/ |
||||||
|
COPY vassal-shim/release/vassal-shim.jar ./vassal-shim/release/ |
||||||
|
COPY setup.py LICENSE.txt ./ |
||||||
|
RUN pip3 install --editable . |
||||||
|
|
||||||
|
# install the config files |
||||||
|
COPY docker/config/ ./vasl_templates/webapp/config/ |
||||||
|
RUN if [ "$ENABLE_TESTS" ]; then \ |
||||||
|
echo "ENABLE_REMOTE_TEST_CONTROL = 1" >>vasl_templates/webapp/config/debug.cfg \ |
||||||
|
; fi |
||||||
|
|
||||||
# create a new user |
# create a new user |
||||||
RUN useradd --create-home app |
RUN useradd --create-home app |
||||||
USER app |
USER app |
||||||
|
|
||||||
EXPOSE 5010 |
EXPOSE 5010 |
||||||
COPY docker/run.sh . |
COPY docker/run.sh ./ |
||||||
CMD ./run.sh |
CMD ./run.sh |
||||||
|
Loading…
Reference in new issue