Skip to content

Commit f8195ec

Browse files
committed
Fixed puppeteer
1 parent bb3fc78 commit f8195ec

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,4 @@ build/
134134

135135
# Secrets
136136
tokens.json
137+
docker-compose.yml

docker-compose.yml.example

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3.8"
2+
3+
services:
4+
app:
5+
image: jvik/elaway-gateway-api:latest
6+
environment:
7+
- ELAWAY_USER=
8+
- ELAWAY_PASSWORD=
9+
- ELAWAY_CLIENT_ID=
10+
- ELAWAY_CLIENT_SECRET=
11+
- CLIENT_ID=
12+
- PORT=3000
13+
ports:
14+
- "3000:3000"

dockerfile

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
# Use the official Node.js image as a base image
2-
FROM node:20.11.0
1+
FROM node:slim
2+
3+
# We don't need the standalone Chromium
4+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
5+
6+
# Install Google Chrome Stable and fonts
7+
# Note: this installs the necessary libs to make the browser work with Puppeteer.
8+
RUN apt-get update && apt-get install gnupg wget -y && \
9+
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
10+
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
11+
apt-get update && \
12+
apt-get install google-chrome-stable -y --no-install-recommends && \
13+
rm -rf /var/lib/apt/lists/*
314

415
# Set the working directory inside the container
516
WORKDIR /app

src/auth.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ async function startOauth(): Promise<ElawayTokenResponse | null> {
151151
let accessIdResponse: null | IdTokenResponse = null;
152152
const authUrl = `${elawayAuthorizationUrl}?response_type=code&client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(redirectUri)}&scope=${encodeURIComponent(oauthScope)}&state=${encodeURIComponent(state)}`;
153153

154-
const browser = await puppeteer.launch({ headless: true });
154+
const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox'] });
155155
const page = await browser.newPage();
156156

157157
try {

0 commit comments

Comments
 (0)