-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
4 changed files
with
35 additions
and
37 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 |
---|---|---|
@@ -1,34 +1,31 @@ | ||
FROM node:slim | ||
|
||
# We don't need the standalone Chromium | ||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true | ||
|
||
# Install Google Chrome Stable and fonts | ||
# Note: this installs the necessary libs to make the browser work with Puppeteer. | ||
RUN apt-get update && apt-get install gnupg wget -y && \ | ||
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \ | ||
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \ | ||
apt-get update && \ | ||
apt-get install google-chrome-stable -y --no-install-recommends && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Set the working directory inside the container | ||
# Stage: Chrome-base (Bygges én gang og gjenbrukes) | ||
FROM node:slim AS chrome-base | ||
RUN apt-get update && apt-get install curl gnupg -y \ | ||
&& curl --location --silent https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | ||
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ | ||
&& apt-get update \ | ||
&& apt-get install google-chrome-stable -y --no-install-recommends \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Stage: builder (Bygg appen) | ||
FROM chrome-base AS builder | ||
WORKDIR /app | ||
|
||
# Copy the package.json and package-lock.json files to the working directory | ||
COPY package*.json ./ | ||
|
||
# Install dependencies | ||
RUN npm install | ||
COPY tsconfig.json ./ | ||
COPY src/ ./src | ||
RUN npm run build | ||
|
||
# Copy the rest of the application code to the working directory | ||
COPY . . | ||
# Stage: runtime (Bruker chrome-base som grunnlag) | ||
FROM chrome-base | ||
WORKDIR /app | ||
|
||
# Build the TypeScript project | ||
RUN npm run build | ||
# Installer kun prod-avhengigheter | ||
COPY package*.json ./ | ||
RUN npm install --only=production | ||
|
||
# Expose port 3000 | ||
EXPOSE 3000 | ||
# Kopierer kun nødvendige filer fra builder | ||
COPY --from=builder /app/dist ./dist | ||
|
||
# Command to run the application | ||
EXPOSE 3000 | ||
CMD ["node", "dist/src/main.js"] |
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