-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parser): Added Docker support with new parameter to define outpu…
…t path for exported files - **Dockerfile**: - Added new file Dockerfile for building Docker image. - **README.md**: - Added section for Docker - A usage of application updated to include new parameters `-p` and `--output-path`. - **app.ts**: - Added new variable `outputPath` to define the path of the output file. - Updated function for parsing input parameters to include the new parameters `-p` and `--output-path` with defined default value. - Updated `console.log` messages to include the new parameters. - Updated constant for calling a Chromium browser, including new arguments for launching browser in Docker container. - Updated calling `writeJson` and `writeCsv` functions to include the new `outputPath` parameter. - **write.ts**: - Function `writeJson`: Added new parameter `outputPath` to define the path of the output file. - Function `writeJson`: Updated constant `outFilename` where base path is defined by `outputPath` variable, not hard-coded anymore. - Function `writeCsv`: Added new parameter `outputPath` to define the path of the output file. - Function `writeCsv`: Updated constant `outFilename` where base path is defined by `outputPath` variable, not hard-coded anymore.
- Loading branch information
Jan Pelikan
committed
Sep 20, 2024
1 parent
8dbf397
commit 5c9a49f
Showing
4 changed files
with
123 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Default architecture | ||
ARG ARCH=amd64 | ||
|
||
# Use the official lightweight Node.js 22 image | ||
FROM $ARCH/node:22-slim | ||
|
||
# Do not download Chromium, will be installed manually from Debian repositories | ||
ENV PUPPETEER_SKIP_DOWNLOAD true | ||
# Set the path to the Chromium executable | ||
ENV PUPPETEER_EXECUTABLE_PATH "/usr/bin/chromium" | ||
|
||
# Create a directory for the app | ||
WORKDIR /app | ||
|
||
# Create a directory for the app data | ||
RUN mkdir /data | ||
|
||
# Set volume for the app data | ||
VOLUME /data | ||
|
||
# Install dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
wget \ | ||
ca-certificates \ | ||
chromium \ | ||
fonts-liberation \ | ||
libasound2 \ | ||
libatk1.0-0 \ | ||
libc6 \ | ||
libcairo2 \ | ||
libcups2 \ | ||
libdbus-1-3 \ | ||
libexpat1 \ | ||
libfontconfig1 \ | ||
libgbm-dev \ | ||
libgcc1 \ | ||
libglib2.0-0 \ | ||
libgdk-pixbuf2.0-0 \ | ||
libgtk-3-0 \ | ||
libnspr4 \ | ||
libnss3 \ | ||
libpango-1.0-0 \ | ||
libpangocairo-1.0-0 \ | ||
libx11-6 \ | ||
libx11-xcb1 \ | ||
libxcb1 \ | ||
libxcomposite1 \ | ||
libxcursor1 \ | ||
libxdamage1 \ | ||
libxext6 \ | ||
libxfixes3 \ | ||
libxi6 \ | ||
libxrandr2 \ | ||
libxrender1 \ | ||
libxss1 \ | ||
libxtst6 \ | ||
lsb-release \ | ||
xdg-utils \ | ||
libu2f-udev \ | ||
libvulkan1 \ | ||
--no-install-recommends \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the app files (azure-vm-pricing) to the container | ||
COPY ./parser . | ||
|
||
# When use a non-root user, the processes under the user will not have access to mounted volumes for some reason | ||
# # Create a non-root user to run Puppeteer | ||
# RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \ | ||
# && mkdir -p /home/pptruser/Downloads \ | ||
# && chown -R pptruser:pptruser /home/pptruser \ | ||
# && chown -R pptruser:pptruser /app | ||
|
||
# # Switch to the non-root user | ||
# USER pptruser | ||
|
||
# Install Yarn and dependencies | ||
RUN yarn install |
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
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