Skip to content

Commit eec497c

Browse files
committed
fix: 크롬 헤드리스 버전으로 변경
1 parent 9b50c76 commit eec497c

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

Dockerfile

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
11
FROM openjdk:17-jdk-slim
22

33
RUN apt-get update && apt-get install -y --no-install-recommends \
4-
wget gnupg unzip \
5-
libnss3 libatk-bridge2.0-0 libgbm1 libgtk-3-0 \
6-
libx11-xcb1 libxrandr2 libxdamage1 libxcomposite1 libxss1 libasound2 \
4+
wget unzip libnss3 libatk-bridge2.0-0 libgbm1 \
75
&& rm -rf /var/lib/apt/lists/*
86

97
# Chrome 설치
10-
RUN wget -qO- https://dl.google.com/linux/linux_signing_key.pub \
11-
| gpg --dearmor -o /usr/share/keyrings/google.gpg \
12-
&& echo "deb [signed-by=/usr/share/keyrings/google.gpg] \
13-
https://dl.google.com/linux/chrome/deb/ stable main" \
14-
> /etc/apt/sources.list.d/google.list \
15-
&& apt-get update \
16-
&& apt-get install -y --no-install-recommends \
17-
google-chrome-stable=135.0.7049.84-1 \
18-
&& rm -rf /var/lib/apt/lists/*
8+
RUN wget -qO /tmp/chrome-shell.zip \
9+
https://storage.googleapis.com/chrome-for-testing-public/135.0.7049.95/linux64/chrome-headless-shell-linux64.zip \
10+
&& unzip /tmp/chrome-shell.zip -d /opt \
11+
&& mv /opt/headless-shell-linux64 /opt/headless-shell \
12+
&& ln -s /opt/headless-shell/headless-shell /usr/bin/headless-shell \
13+
&& rm /tmp/chrome-shell.zip
1914

2015
# Chromedriver 설치
2116
RUN wget -qO /tmp/chromedriver.zip \
22-
https://chromedriver.storage.googleapis.com/135.0.7049.84/chromedriver_linux64.zip \
17+
https://storage.googleapis.com/chrome-for-testing-public/135.0.7049.95/linux64/chromedriver-linux64.zip \
2318
&& unzip /tmp/chromedriver.zip -d /usr/local/bin \
2419
&& chmod +x /usr/local/bin/chromedriver \
2520
&& rm /tmp/chromedriver.zip
2621

27-
# 환경 변수 설정
28-
ENV CHROME_OPTIONS="--headless --no-sandbox --disable-dev-shm-usage"
29-
3022
# 애플리케이션 설정
3123
ARG JAR_FILE_PATH=/build/libs/*.jar
3224
COPY $JAR_FILE_PATH app.jar

src/main/java/com/davcatch/devcatch/common/integration/selenium/SeleniumBrowserService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public class SeleniumBrowserService {
2727
private WebDriver createWebDriver() throws CustomException {
2828
try {
2929
ChromeOptions options = new ChromeOptions();
30+
options.setBinary("/usr/bin/headless-shell");
31+
3032
options.addArguments("--headless=new");
3133
options.addArguments("--disable-gpu");
3234
options.addArguments("--no-sandbox");

0 commit comments

Comments
 (0)