Improved Dockerfile.
This commit is contained in:
parent
7b8d577f03
commit
c1bcd47220
27
Dockerfile
27
Dockerfile
|
@ -1,30 +1,26 @@
|
|||
FROM node AS node
|
||||
|
||||
FROM selenium/standalone-firefox AS ff
|
||||
|
||||
FROM python:3.7-buster
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
COPY --from=node /usr/local /usr/local
|
||||
COPY --from=node /opt /opt
|
||||
ARG FIREFOX_VERSION=latest
|
||||
RUN FIREFOX_DOWNLOAD_URL=$(if [ $FIREFOX_VERSION = "latest" ] || [ $FIREFOX_VERSION = "nightly-latest" ] || [ $FIREFOX_VERSION = "devedition-latest" ]; then echo "https://download.mozilla.org/?product=firefox-$FIREFOX_VERSION-ssl&os=linux64&lang=en-US"; else echo "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$FIREFOX_VERSION/linux-x86_64/en-US/firefox-$FIREFOX_VERSION.tar.bz2"; fi) \
|
||||
&& apt-get update -qqy \
|
||||
&& apt-get -qqy --no-install-recommends install firefox-esr \
|
||||
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
|
||||
&& wget --no-verbose -O /tmp/firefox.tar.bz2 $FIREFOX_DOWNLOAD_URL \
|
||||
&& apt-get -y purge firefox-esr \
|
||||
&& rm -rf /opt/firefox \
|
||||
&& tar -C /opt -xjf /tmp/firefox.tar.bz2 \
|
||||
&& rm /tmp/firefox.tar.bz2 \
|
||||
&& mv /opt/firefox /opt/firefox-$FIREFOX_VERSION \
|
||||
&& ln -fs /opt/firefox-$FIREFOX_VERSION/firefox /usr/bin/firefox
|
||||
COPY --from=ff /opt/firefox-latest /opt/firefox-latest
|
||||
COPY --from=ff /opt/geckodriver* /opt/
|
||||
COPY . /app
|
||||
WORKDIR /app/bot.z_web
|
||||
RUN yarn install \
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y $(apt-cache depends firefox-esr| awk '/Depends:/{print$2}') \
|
||||
&& ln -s /opt/firefox-latest/firefox /usr/bin/firefox \
|
||||
&& ln -s /opt/geckodriver* /usr/bin/geckodriver \
|
||||
&& yarn install \
|
||||
&& yarn build \
|
||||
&& mkdir -p /app/api/assets \
|
||||
&& cp -r build/* /app/api/assets/ \
|
||||
&& rm -r node_modules/
|
||||
&& rm -r node_modules/ /var/lib/apt/lists/* /var/cache/apt/* /tmp/*
|
||||
WORKDIR /app
|
||||
RUN python setup.py develop
|
||||
|
||||
|
@ -32,3 +28,4 @@ EXPOSE 3003
|
|||
VOLUME ["/app/bot.z_web/node_modules"]
|
||||
|
||||
ENTRYPOINT ["z_app"]
|
||||
CMD ["-a", "0.0.0.0"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user