Move docker images to ubuntu (#620)

* Move docker images to ubuntu

Co-authored-by: Michael Nutt <michael@nuttnet.net>
This commit is contained in:
Andrew Calcutt 2022-10-05 09:11:03 -04:00 committed by GitHub
parent 38604c0a45
commit f8a0ab6d3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 116 additions and 69 deletions

View file

@ -1,6 +1,7 @@
* *
!src !src
!public !public
!test
!package.json !package.json
!package-lock.json !package-lock.json
!docker-entrypoint.sh !docker-entrypoint.sh

View file

@ -1,57 +1,76 @@
FROM node:16-bullseye AS builder FROM ubuntu:focal AS builder
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq update \
&& apt-get -y --no-install-recommends install \
apt-transport-https \
curl \
unzip \
build-essential \
python \
libcairo2-dev \
libgles2-mesa-dev \
libgbm-dev \
libprotobuf-dev \
&& apt-get -y --purge autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY . /usr/src/app
ENV NODE_ENV="production" ENV NODE_ENV="production"
RUN set -ex; \
export DEBIAN_FRONTEND=noninteractive; \
apt-get -qq update; \
apt-get -y --no-install-recommends install \
build-essential \
ca-certificates \
wget \
pkg-config \
xvfb \
libglfw3-dev \
libuv1-dev \
libjpeg-turbo8 \
libicu66 \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
libcurl4-openssl-dev \
libpixman-1-dev; \
wget -qO- https://deb.nodesource.com/setup_16.x | bash; \
apt-get install -y nodejs; \
apt-get -y remove wget; \
apt-get -y --purge autoremove; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
RUN mkdir -p /usr/src/app
COPY package.json /usr/src/app
RUN cd /usr/src/app && npm install --production RUN cd /usr/src/app && npm install --production
FROM ubuntu:focal AS final
FROM node:16-bullseye-slim AS final ENV \
NODE_ENV="production" \
CHOKIDAR_USEPOLLING=1 \
CHOKIDAR_INTERVAL=500
RUN export DEBIAN_FRONTEND=noninteractive \ RUN set -ex; \
&& apt-get -qq update \ export DEBIAN_FRONTEND=noninteractive; \
&& apt-get -y --no-install-recommends install \ groupadd -r node; \
libgles2-mesa \ useradd -r -g node node; \
libegl1 \ apt-get -qq update; \
apt-get -y --no-install-recommends install \
ca-certificates \
wget \
xvfb \ xvfb \
xauth \ libglfw3 \
libuv1 \
libjpeg-turbo8 \
libicu66 \
libcairo2 \
libgif7 \
libopengl0 \ libopengl0 \
libpixman-1-0 \
libcurl4 \ libcurl4 \
curl \ librsvg2-2 \
libuv1-dev \ libpango1.0; \
libc6-dev \ wget -qO- https://deb.nodesource.com/setup_16.x | bash; \
libcap2-bin \ apt-get install -y nodejs; \
&& apt-get -y --purge autoremove \ apt-get -y remove wget; \
&& apt-get clean \ apt-get -y --purge autoremove; \
&& rm -rf /var/lib/apt/lists/* apt-get clean; \
rm -rf /var/lib/apt/lists/*;
RUN curl http://archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb --output libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb
RUN apt install ./libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb
RUN curl http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu66_66.1-2ubuntu2_amd64.deb --output libicu66_66.1-2ubuntu2_amd64.deb
RUN apt install ./libicu66_66.1-2ubuntu2_amd64.deb
COPY --from=builder /usr/src/app /app COPY --from=builder /usr/src/app /usr/src/app
ENV NODE_ENV="production" COPY . /usr/src/app
ENV CHOKIDAR_USEPOLLING=1
ENV CHOKIDAR_INTERVAL=500
VOLUME /data VOLUME /data
WORKDIR /data WORKDIR /data
@ -60,4 +79,4 @@ EXPOSE 80
USER node:node USER node:node
ENTRYPOINT ["/app/docker-entrypoint.sh"] ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]

View file

@ -1,8 +1,25 @@
FROM node:16-bullseye FROM ubuntu:focal
ENV \
NODE_ENV="production" \
CHOKIDAR_USEPOLLING=1 \
CHOKIDAR_INTERVAL=500
RUN set -ex; \
export DEBIAN_FRONTEND=noninteractive; \
groupadd -r node; \
useradd -r -g node node; \
apt-get -qq update; \
apt-get -y --no-install-recommends install \
ca-certificates \
wget; \
wget -qO- https://deb.nodesource.com/setup_16.x | bash; \
apt-get install -y nodejs; \
apt-get -y remove wget; \
apt-get -y --purge autoremove; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
ENV NODE_ENV="production"
ENV CHOKIDAR_USEPOLLING=1
ENV CHOKIDAR_INTERVAL=500
EXPOSE 80 EXPOSE 80
VOLUME /data VOLUME /data
WORKDIR /data WORKDIR /data
@ -12,3 +29,4 @@ RUN mkdir -p /usr/src/app
COPY / /usr/src/app COPY / /usr/src/app
RUN cd /usr/src/app && npm install --production RUN cd /usr/src/app && npm install --production
RUN ["chmod", "+x", "/usr/src/app/docker-entrypoint.sh"] RUN ["chmod", "+x", "/usr/src/app/docker-entrypoint.sh"]
USER node:node

View file

@ -2,34 +2,43 @@
# Simply run "docker build -f Dockerfile_test ." # Simply run "docker build -f Dockerfile_test ."
# WARNING: sometimes it fails with a core dumped exception # WARNING: sometimes it fails with a core dumped exception
FROM node:16-bullseye FROM ubuntu:focal
RUN apt-get -qq update \ ENV NODE_ENV="development"
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
apt-transport-https \ RUN set -ex; \
curl \ export DEBIAN_FRONTEND=noninteractive; \
unzip \ apt-get -qq update; \
build-essential \ apt-get -y --no-install-recommends install \
python \ unzip \
libcairo2-dev \ build-essential \
libgles2-mesa-dev \ ca-certificates \
libgbm-dev \ wget \
libllvm3.9 \ pkg-config \
libprotobuf-dev \ xvfb \
libxxf86vm-dev \ libglfw3-dev \
libopengl0 \ libuv1-dev \
xvfb \ libjpeg-turbo8 \
&& apt-get clean libicu66 \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
libcurl4-openssl-dev \
libpixman-1-dev; \
wget -qO- https://deb.nodesource.com/setup_16.x | bash; \
apt-get install -y nodejs; \
apt-get clean;
RUN mkdir -p /usr/src/app RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app WORKDIR /usr/src/app
RUN wget -O test_data.zip https://github.com/maptiler/tileserver-gl/releases/download/v1.3.0/test_data.zip RUN wget -O test_data.zip https://github.com/maptiler/tileserver-gl/releases/download/v1.3.0/test_data.zip; \
RUN unzip -q test_data.zip -d test_data unzip -q test_data.zip -d test_data
ENV NODE_ENV="test"
COPY package.json . COPY package.json .
RUN npm install RUN npm install
COPY / . COPY / .
RUN xvfb-run --server-args="-screen 0 1024x768x24" npm test RUN xvfb-run --server-args="-screen 0 1024x768x24" npm test

View file

@ -20,7 +20,7 @@ trap refresh HUP
if ! which -- "${1}"; then if ! which -- "${1}"; then
# first arg is not an executable # first arg is not an executable
xvfb-run -a --server-args="-screen 0 1024x768x24" -- node /app/ -p 80 "$@" & xvfb-run -a --server-args="-screen 0 1024x768x24" -- node /usr/src/app/ -p 80 "$@" &
# Wait exits immediately on signals which have traps set. Store return value and wait # Wait exits immediately on signals which have traps set. Store return value and wait
# again for all jobs to actually complete before continuing. # again for all jobs to actually complete before continuing.
wait $! || RETVAL=$? wait $! || RETVAL=$?