Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use npm packages for public/resources #1427

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions .github/workflows/automerger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ jobs:
- uses: fastify/github-action-merge-dependabot@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
target: minor
91 changes: 41 additions & 50 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ FROM ubuntu:jammy AS builder

ENV NODE_ENV="production"

RUN set -ex; \
export DEBIAN_FRONTEND=noninteractive; \
apt-get -qq update; \
apt-get -y --no-install-recommends install \
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
build-essential \
ca-certificates \
curl \
Expand All @@ -26,23 +27,17 @@ RUN set -ex; \
librsvg2-common \
libcurl4-openssl-dev \
libpixman-1-dev \
libpixman-1-0; \
apt-get -y --purge autoremove; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN mkdir -p /etc/apt/keyrings; \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list; \
apt-get -qq update; \
apt-get install -y nodejs; \
npm i -g npm@latest; \
apt-get -y remove curl gnupg; \
apt-get -y --purge autoremove; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
libpixman-1-0 && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get -qq update && \
apt-get install -y --no-install-recommends --no-install-suggests nodejs && \
npm i -g npm@latest && \
apt-get -y remove curl gnupg && \
apt-get -y --purge autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN mkdir -p /usr/src/app

Expand All @@ -51,12 +46,13 @@ WORKDIR /usr/src/app
COPY package.json /usr/src/app
COPY package-lock.json /usr/src/app

RUN npm config set maxsockets 1; \
npm config set fetch-retries 5; \
npm config set fetch-retry-mintimeout 100000; \
npm config set fetch-retry-maxtimeout 600000; \
npm ci --omit=dev; \
chown -R root:root /usr/src/app;
RUN npm config set maxsockets 1 && \
npm config set fetch-retries 5 && \
npm config set fetch-retry-mintimeout 100000 && \
npm config set fetch-retry-maxtimeout 600000 && \
npm install -g [email protected] && \
npm ci --omit=dev && \
chown -R root:root /usr/src/app

FROM ubuntu:jammy AS final

Expand All @@ -65,12 +61,13 @@ ENV \
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 \
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN export DEBIAN_FRONTEND=noninteractive && \
groupadd -r node && \
useradd -r -g node node && \
apt-get -qq update && \
apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates \
curl \
gnupg \
Expand All @@ -85,23 +82,17 @@ RUN set -ex; \
libpixman-1-0 \
libcurl4 \
librsvg2-2 \
libpango-1.0-0; \
apt-get -y --purge autoremove; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN mkdir -p /etc/apt/keyrings; \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list; \
apt-get -qq update; \
apt-get install -y nodejs; \
npm i -g npm@latest; \
apt-get -y remove curl gnupg; \
apt-get -y --purge autoremove; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;
libpango-1.0-0 && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get -qq update && \
apt-get install -y --no-install-recommends --no-install-suggests nodejs && \
npm i -g npm@latest && \
apt-get -y remove curl gnupg && \
apt-get -y --purge autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY --from=builder /usr/src/app /usr/src/app

Expand Down
38 changes: 38 additions & 0 deletions Dockerfile_build
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM ubuntu:jammy AS builder

ENV NODE_ENV="devel"

RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
build-essential \
ca-certificates \
curl \
gnupg \
pkg-config \
xvfb \
libglfw3-dev \
libuv1-dev \
libjpeg-turbo8 \
libicu70 \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
gir1.2-rsvg-2.0 \
librsvg2-2 \
librsvg2-common \
libcurl4-openssl-dev \
libpixman-1-dev \
libpixman-1-0 && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get -qq update && \
apt-get install -y --no-install-recommends --no-install-suggests nodejs && \
npm i -g npm@latest && \
apt-get -y remove curl gnupg && \
apt-get -y --purge autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
69 changes: 33 additions & 36 deletions Dockerfile_light
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,46 @@ ENV \
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 \
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN export DEBIAN_FRONTEND=noninteractive && \
groupadd -r node && \
useradd -r -g node node && \
apt-get -qq update && \
apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates \
curl \
gnupg; \
mkdir -p /etc/apt/keyrings; \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list; \
apt-get -qq update; \
apt-get install -y nodejs; \
npm i -g npm@latest; \
apt-get -y remove curl gnupg; \
apt-get -y --purge autoremove; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*;

EXPOSE 8080

RUN mkdir -p /data; \
chown node:node /data; \
mkdir -p /usr/src/app;

gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get -qq update && \
apt-get install -y --no-install-recommends --no-install-suggests nodejs && \
npm i -g npm@latest && \
apt-get -y remove curl gnupg && \
apt-get -y --purge autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/app
COPY . .

RUN npm config set maxsockets 1 && \
npm config set fetch-retries 5 && \
npm config set fetch-retry-mintimeout 100000 && \
npm config set fetch-retry-maxtimeout 600000 && \
npm install --omit=dev && \
chown -R root:root . && \
chmod +x ./docker-entrypoint.sh

RUN mkdir -p /data && chown node:node /data
VOLUME /data

WORKDIR /data

COPY / /usr/src/app

RUN cd /usr/src/app; \
npm config set maxsockets 1; \
npm config set fetch-retries 5; \
npm config set fetch-retry-mintimeout 100000; \
npm config set fetch-retry-maxtimeout 600000; \
npm install --omit=dev; \
chown -R root:root /usr/src/app; \
chmod +x /usr/src/app/docker-entrypoint.sh;
EXPOSE 8080

USER node:node

ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]

HEALTHCHECK CMD node /usr/src/app/src/healthcheck.js
HEALTHCHECK CMD node /usr/src/app/src/healthcheck.js
Loading
Loading