Last active
March 14, 2022 20:37
-
-
Save dsumer/834cf707af0985ee48d3a7f38110be59 to your computer and use it in GitHub Desktop.
Dockerfile playwright
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
FROM ubuntu:focal | |
ARG DEBIAN_FRONTEND=noninteractive | |
ARG TZ=Europe/Vienna | |
# === INSTALL Node.js === | |
RUN apt-get update && \ | |
# Install node16 | |
apt-get install -y curl wget && \ | |
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ | |
apt-get install -y nodejs && \ | |
# Feature-parity with node.js base images. | |
apt-get install -y --no-install-recommends git openssh-client && \ | |
npm install -g yarn && \ | |
# clean apt cache | |
rm -rf /var/lib/apt/lists/* && \ | |
# Create the pwuser | |
adduser pwuser | |
WORKDIR /usr/src/app | |
# Copy package.json and package-lock.json before other files | |
# Utilise Docker cache to save re-installing dependencies if unchanged | |
COPY ./package.json ./ | |
COPY ./yarn.lock ./ | |
# Install dependencies | |
RUN yarn | |
WORKDIR /usr/src/app/api | |
COPY ./api/package.json ./ | |
COPY ./api/yarn.lock ./ | |
# Install dependencies | |
RUN yarn | |
WORKDIR /usr/src/app | |
# Copy all files | |
COPY ./ ./ | |
WORKDIR /usr/src/app/api | |
# Build app | |
RUN yarn build | |
RUN npx playwright install | |
RUN npx playwright install-deps | |
ENV NODE_ENV=production | |
# Run npm start script when container starts | |
CMD yarn start:prod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment