Skip to content

Commit

Permalink
Fixed puppeteer
Browse files Browse the repository at this point in the history
  • Loading branch information
jvik committed Dec 21, 2024
1 parent bb3fc78 commit f8195ec
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ build/

# Secrets
tokens.json
docker-compose.yml
14 changes: 14 additions & 0 deletions docker-compose.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.8"

services:
app:
image: jvik/elaway-gateway-api:latest
environment:
- ELAWAY_USER=
- ELAWAY_PASSWORD=
- ELAWAY_CLIENT_ID=
- ELAWAY_CLIENT_SECRET=
- CLIENT_ID=
- PORT=3000
ports:
- "3000:3000"
15 changes: 13 additions & 2 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Use the official Node.js image as a base image
FROM node:20.11.0
FROM node:slim

# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install google-chrome-stable -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/*

# Set the working directory inside the container
WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async function startOauth(): Promise<ElawayTokenResponse | null> {
let accessIdResponse: null | IdTokenResponse = null;
const authUrl = `${elawayAuthorizationUrl}?response_type=code&client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(redirectUri)}&scope=${encodeURIComponent(oauthScope)}&state=${encodeURIComponent(state)}`;

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

try {
Expand Down

0 comments on commit f8195ec

Please sign in to comment.