基于官方镜像制作服务镜像
#FROM node:lts-alpine
#FROM playwright/chromium
#
## https://playwright.dev/docs/docker
# Playwright for Java
## https://playwright.dev/java/docs/docker
FROM mcr.microsoft.com/playwright:v1.40.1-jammy
#FROM mcr.microsoft.com/playwright:v1.35.0-focal
# Update Apt Repositories to Aliyun、Ustc、Tuna、163
RUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
#RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
#RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
#RUN sed -i 's/archive.ubuntu.com/mirrors.163.com/g' /etc/apt/sources.list
# Fix certificate issues and install missing tools
RUN apt-get update \
&& apt-get install -y apt-transport-https ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Time Zone Database And Modify timezone to Asia/Shanghai
ENV TZ=Asia/Shanghai \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y tzdata \
&& ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*
# Install Font Packages
RUN apt-get update \
&& apt-get install -y language-pack-zh-hans* ibus-pinyin \
&& apt-get install -y fonts-wqy-zenhei fonts-droid-fallback ttf-wqy-zenhei ttf-wqy-microhei fonts-arphic-ukai fonts-arphic-uming \
&& rm -rf /var/lib/apt/lists/*
RUN locale-gen zh_CN.GBK
RUN locale-gen zh_CN.UTF-8
ENV LANG=zh_CN.UTF-8
ENV LC_ALL=zh_CN.UTF-8
ENV LANGUAGE=zh_CN:zh:en_US:en
#RUN echo 'export LANG=zh_CN.UTF-8' >> /etc/profile
#RUN echo 'export LC_ALL=zh_CN.UTF-8' >> /etc/profile
#RUN echo 'export LANGUAGE=zh_CN:zh:en_US:en' >> /etc/profile
#RUN source /etc/profile
# https://github.com/NickNaso/ghostscript4js#install
#RUN apt-get install ghostscript libgs-dev -y
WORKDIR /APP
# Install browsers
RUN npx playwright install-deps chromium
# 拷贝打包的资源
COPY . /APP
COPY package.json package.json
# Install dependencies
RUN npm install cnpm -g --registry=https://mirrors.sjtug.sjtu.edu.cn/npm-registry && PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=true cnpm install
CMD ["npm", "start"]
基于三方镜像制作服务镜像
# Use Ubuntu Linux As Base Image
# View Code on Github : https://github.com/JacobLinCool/playwright-docker
# View on Docker Hub: https://hub.docker.com/r/jacoblincool/playwright/
# Tags:
# jacoblincool/playwright:base - Ubuntu 20.04.6 LTS, Node v18.16.1, Playwright
# jacoblincool/playwright:pnpm - Ubuntu 20.04.6 LTS, Node v18.16.1, Playwright
# jacoblincool/playwright:chromium - Ubuntu 20.04.6 LTS, Node v18.16.1, Playwright , Chromium 119.0.6045.9
# jacoblincool/playwright:firefox - Ubuntu 20.04.6 LTS, Node v18.16.1, Playwright , Mozilla Firefox 118.0.1
# jacoblincool/playwright:webkit - Ubuntu 20.04.6 LTS, Node v18.16.1, Playwright , WPE WebKit 2.41.2 (unknown)
# jacoblincool/playwright:chrome - Ubuntu 20.04.6 LTS, Node v18.16.1, Playwright , Google Chrome 119.0.6045.159
# jacoblincool/playwright:msedge - Ubuntu 20.04.6 LTS, Node v18.16.1, Playwright , Microsoft Edge 119.0.2151.58
# jacoblincool/playwright:all - Ubuntu 20.04.6 LTS, Node v18.16.1, Playwright , Chromium 119.0.6045.9 , Mozilla Firefox 118.0.1, WPE WebKit 2.41.2 (unknown), Google Chrome 119.0.6045.159 , Microsoft Edge 119.0.2151.58
FROM jacoblincool/playwright:chromium
# The Author
MAINTAINER hiwepy@gmail.com
# Update Apt Repositories to Aliyun、Ustc、Tuna、163
RUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
#RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
#RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
#RUN sed -i 's/archive.ubuntu.com/mirrors.163.com/g' /etc/apt/sources.list
# Fix certificate issues and install missing tools
RUN apt-get update \
&& apt-get install -y apt-transport-https ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Time Zone Database And Modify timezone to Asia/Shanghai
ENV TZ=Asia/Shanghai \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y tzdata \
&& ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*
# Install Font Packages
RUN apt-get update \
&& apt-get install -y language-pack-zh-hans* ibus-pinyin \
&& apt-get install -y fonts-wqy-zenhei fonts-droid-fallback ttf-wqy-zenhei ttf-wqy-microhei fonts-arphic-ukai fonts-arphic-uming \
&& rm -rf /var/lib/apt/lists/*
RUN locale-gen zh_CN.GBK
RUN locale-gen zh_CN.UTF-8
ENV LANG=zh_CN.UTF-8
ENV LC_ALL=zh_CN.UTF-8
ENV LANGUAGE=zh_CN:zh:en_US:en
#RUN echo 'export LANG=zh_CN.UTF-8' >> /etc/profile
#RUN echo 'export LC_ALL=zh_CN.UTF-8' >> /etc/profile
#RUN echo 'export LANGUAGE=zh_CN:zh:en_US:en' >> /etc/profile
#RUN source /etc/profile
# https://github.com/NickNaso/ghostscript4js#install
#RUN apt-get install ghostscript libgs-dev -y
WORKDIR /APP
# Install browsers
#RUN npx playwright install-deps chromium
# 拷贝打包的资源
COPY . /APP
COPY package.json package.json
# Install dependencies
RUN npm install cnpm -g --registry=https://mirrors.sjtug.sjtu.edu.cn/npm-registry && PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=true cnpm install
CMD ["npm", "start"]
作者:Jeebiz 创建时间:2024-01-25 20:15
最后编辑:Jeebiz 更新时间:2024-03-22 19:10
最后编辑:Jeebiz 更新时间:2024-03-22 19:10