-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eliezer Rangel
committed
Jul 1, 2024
1 parent
b778ef5
commit 70b6c2c
Showing
78 changed files
with
343 additions
and
11,047 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,107 @@ | ||
FROM --platform=linux/amd64 node:lts-alpine | ||
|
||
FROM --platform=linux/amd64 node:18.20-alpine3.19 | ||
EXPOSE 5488 | ||
USER root | ||
ARG TARGETPLATFORM | ||
ARG UID=2500 | ||
ARG GID=2500 | ||
|
||
ENV GOSU_VERSION 1.17 | ||
RUN set -eux; \ | ||
\ | ||
apk add --no-cache --virtual .gosu-deps \ | ||
ca-certificates \ | ||
dpkg \ | ||
gnupg \ | ||
; \ | ||
\ | ||
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ | ||
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ | ||
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ | ||
\ | ||
# verify the signature | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ | ||
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ | ||
command -v gpgconf && gpgconf --kill all || :; \ | ||
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ | ||
\ | ||
# clean up fetch dependencies | ||
apk del --no-network .gosu-deps; \ | ||
\ | ||
chmod +x /usr/local/bin/gosu; \ | ||
# verify that the binary works | ||
gosu --version; \ | ||
gosu nobody true | ||
|
||
RUN addgroup -g "${GID}" -S jsreport && adduser --shell /bin/bash -u "${UID}" -S -G jsreport jsreport | ||
|
||
# this condition is useful when the alpine registry contain different latest versions | ||
# per architecture, if the versions match then just use the same version number on both paths | ||
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ | ||
export CHROMIUM_TO_INSTALL_VERSION="124.0.6367.78-r0"; \ | ||
elif [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ | ||
export CHROMIUM_TO_INSTALL_VERSION="126.0.6478.61-r0"; \ | ||
fi && \ | ||
echo "Installing Chromium $CHROMIUM_TO_INSTALL_VERSION version.." && \ | ||
apk update --no-cache && \ | ||
echo @edge http://dl-cdn.alpinelinux.org/alpine/v3.19/community >> /etc/apk/repositories && \ | ||
echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \ | ||
echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \ | ||
apk add --no-cache \ | ||
libstdc++@edge \ | ||
chromium@edge=$CHROMIUM_TO_INSTALL_VERSION \ | ||
nss \ | ||
freetype \ | ||
harfbuzz \ | ||
ttf-freefont@edge \ | ||
# just for now as we npm install from git | ||
libcurl@edge=8.8.0-r0 \ | ||
git@edge=2.45.2-r1 \ | ||
# so user can docker exec -it test /bin/bash | ||
bash | ||
|
||
RUN rm -rf /var/cache/apk/* /tmp/* | ||
|
||
RUN mkdir -p /app | ||
|
||
# we need to create the volume and give it expected owner | ||
# before the VOLUME step in order for the volume to be created with non-root user | ||
RUN mkdir /jsreport | ||
RUN chown jsreport:jsreport /jsreport | ||
RUN chmod g+s /jsreport | ||
|
||
WORKDIR /srv | ||
VOLUME ["/jsreport"] | ||
|
||
COPY . /srv | ||
ENV NPM_CONFIG_PREFIX /home/jsreport/.npm-global | ||
ENV PATH $PATH:/home/jsreport/.npm-global/bin | ||
|
||
WORKDIR /app | ||
|
||
ENV PUPPETEER_SKIP_DOWNLOAD true | ||
|
||
RUN npm install -g npm | ||
# ====== COMMENT THIS WHEN CHECKING trivy audit ====== | ||
RUN npm i -g @jsreport/jsreport-cli | ||
RUN jsreport init | ||
# ===================================================== | ||
|
||
# ====== UNCOMMENT THIS WHEN CHECKING trivy audit ====== | ||
# trivy checks should be done with this image default/Dockerfile, | ||
# because it does not add the whole yarn workspace | ||
# (which makes it report vulnerabilities for other packages in the workspace that are not relevant here) | ||
# (we need to build with latest package.json in workspace) | ||
COPY . . | ||
RUN npm install | ||
# ===================================================== | ||
|
||
RUN npm cache clean -f && rm -rf /tmp/* | ||
|
||
RUN chown -R jsreport:jsreport /app | ||
USER jsreport:jsreport | ||
|
||
ENV chrome_launchOptions_executablePath /usr/lib/chromium/chrome | ||
ENV chrome_launchOptions_args --no-sandbox,--disable-dev-shm-usage | ||
|
||
RUN ls | ||
|
||
CMD [ "node", "server.js" ] | ||
CMD ["bash", "run.sh"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
functions/ImageServer/data/Test-Invoice/executions-main/config.json
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
functions/ImageServer/data/Test-Invoice/executions-main/content.handlebars
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
functions/ImageServer/data/samples/Invoice/invoice-data/config.json
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
functions/ImageServer/data/samples/Invoice/invoice-data/dataJson.json
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
functions/ImageServer/data/samples/Invoice/invoice-logo.png/config.json
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-28.8 KB
functions/ImageServer/data/samples/Invoice/invoice-logo.png/content.png
Binary file not shown.
24 changes: 0 additions & 24 deletions
24
functions/ImageServer/data/samples/Invoice/invoice-main/config.json
This file was deleted.
Oops, something went wrong.
81 changes: 0 additions & 81 deletions
81
functions/ImageServer/data/samples/Invoice/invoice-main/content.handlebars
This file was deleted.
Oops, something went wrong.
Empty file removed
0
functions/ImageServer/data/samples/Invoice/invoice-main/footerTemplate.handlebars
Empty file.
Empty file removed
0
functions/ImageServer/data/samples/Invoice/invoice-main/headerTemplate.handlebars
Empty file.
12 changes: 0 additions & 12 deletions
12
functions/ImageServer/data/samples/Invoice/invoice-styles.css/config.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.