1. Dockerfile
FROM node:18.20.2
WORKDIR /usr/src/app
# Lighthouse 설치
RUN npm install -g lighthouse
# Chrome 설치
RUN apt-get update && apt-get install -y wget gnupg2
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
RUN apt-get update && apt-get install -y google-chrome-stable
# 환경 변수 설정
ENV CHROME_PATH /usr/bin/google-chrome
2. 레포트 추출
lighthouse https://google.com --output html --output-path ./report.html --chrome-flags="--headless --no-sandbox --disable-gpu"
'인프라 > Docker' 카테고리의 다른 글
[Docker] Nginx 포워드 프록시 모듈 추가 (ver 1.24) (0) | 2024.01.10 |
---|---|
[Docker] 사용자, 그룹을 tomcat으로 하는 커스텀 tomcat 이미지 생성 (Dockerfile) (0) | 2023.12.08 |
[flask + uwsgi] Dockerfile (0) | 2023.04.29 |
Docker Swarm & Tomcat Session Clustering (0) | 2023.02.14 |
Docker Swarm 구축 (0) | 2023.02.12 |