From 13c0ac0ea38eea351a8663f48bb5a96260e4edb5 Mon Sep 17 00:00:00 2001 From: Valentin Vieriu Date: Tue, 4 Dec 2018 12:10:14 +0100 Subject: [PATCH] using a smaller image for the node build and fixing the arm build too --- .dockerignore | 1 + Dockerfile.amd64 | 24 ++++-------------------- Dockerfile.armhf | 30 ++++++++++-------------------- 3 files changed, 15 insertions(+), 40 deletions(-) diff --git a/.dockerignore b/.dockerignore index a0ae8ea..2329e5a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ web/node_modules +.git diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 index e30310f..72d09e7 100644 --- a/Dockerfile.amd64 +++ b/Dockerfile.amd64 @@ -6,7 +6,7 @@ FROM $image as system ARG localbuild RUN echo "LOCALBUILD=$localbuild" -RUN if [ "x$localbuild" != "x" ]; then sed -i 's#http://archive.ubuntu.com/#http://'$localbuild'tw.archive.ubuntu.com/#' /etc/apt/sources.list; fi +RUN if [ "x$localbuild" != "x" ]; then sed -i 's#http://archive.ubuntu.com/#http://'$localbuild'.archive.ubuntu.com/#' /etc/apt/sources.list; fi ENV DEBIAN_FRONTEND=noninteractive # && add-apt-repository ppa:fcwu-tw/apps x11vnc @@ -55,29 +55,13 @@ RUN apt-get update \ ################################################################################ # builder ################################################################################ -FROM ubuntu:16.04 as builder - -ARG localbuild -RUN if [ "x$localbuild" != "x" ]; then sed -i 's#http://archive.ubuntu.com/#http://'$localbuild'tw.archive.ubuntu.com/#' /etc/apt/sources.list; fi - -RUN apt-get update \ - && apt-get install -y --no-install-recommends curl ca-certificates - -# nodejs -RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \ - && apt-get install -y nodejs - -# yarn -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ - && apt-get update \ - && apt-get install -y yarn +FROM node:8-alpine as builder # build frontend COPY web /src/web RUN cd /src/web \ - && yarn \ - && npm run build + && yarn install \ + && yarn build ################################################################################ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 54f5dd5..478699a 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -8,7 +8,7 @@ FROM arm32v7/ubuntu:18.04 as system COPY --from=amd64 /usr/bin/qemu-arm-static /usr/bin/ ARG localbuild -RUN if [ "x$localbuild" != "x" ]; then sed -i 's#http://archive.ubuntu.com/#http://tw.archive.ubuntu.com/#' /etc/apt/sources.list; fi +RUN if [ "x$localbuild" != "x" ]; then sed -i 's#http://archive.ubuntu.com/#http://'$localbuild'.archive.ubuntu.com/#' /etc/apt/sources.list; fi ENV DEBIAN_FRONTEND noninteractive RUN apt update \ @@ -25,7 +25,7 @@ RUN apt update \ # install debs error if combine together RUN apt update \ && apt install -y --no-install-recommends --allow-unauthenticated \ - lxde xvfb x11vnc \ + lxqt openbox xvfb x11vnc \ firefox chromium-browser \ ttf-ubuntu-font-family ttf-wqy-zenhei \ && apt autoclean -y \ @@ -66,29 +66,19 @@ RUN apt-get update \ ################################################################################ # builder ################################################################################ -FROM ubuntu:18.04 as builder - -ARG localbuild -RUN if [ "x$localbuild" != "x" ]; then sed -i 's#http://archive.ubuntu.com/#http://tw.archive.ubuntu.com/#' /etc/apt/sources.list; fi - -RUN apt-get update \ - && apt-get install -y --no-install-recommends curl ca-certificates gnupg - -# nodejs -RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \ - && apt-get install -y nodejs - -# yarn -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ - && apt-get update \ - && apt-get install -y yarn +FROM node:8-alpine as builder # build frontend COPY web /src/web RUN cd /src/web \ && yarn \ - && npm run build + && yarn run build + +# build frontend +COPY web /src/web +RUN cd /src/web \ + && yarn install \ + && yarn build ################################################################################