Skip to content

Commit 79f810c

Browse files
authored
ci(whatsapp): dockerize whatsapp app (#186)
Signed-off-by: Matheus Cruz <[email protected]>
1 parent e20a680 commit 79f810c

File tree

2 files changed

+51
-15
lines changed

2 files changed

+51
-15
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,27 +99,19 @@ jobs:
9999

100100
- name: Check code formatting with Prettier
101101
run: npm run prettier:check
102-
102+
103103
- name: Login to Quay.io
104-
if: false # Disabled for now: we need to add chrome to the buildpack image first
105104
if: github.repository == 'mcruzdev/timeless'
106105
uses: docker/login-action@v3
107106
with:
108107
registry: quay.io
109108
username: ${{ secrets.QUAY_USERNAME }}
110109
password: ${{ secrets.QUAY_PASSWORD }}
111110

112-
- name: Install pack CLI
113-
if: false # Disabled for now: we need to add chrome to the buildpack image first
111+
- name: Create Docker image
112+
if: github.repository == 'mcruzdev/timeless'
113+
run: docker build -f Dockerfile -t quay.io/timeless/whatsapp:${GITHUB_SHA::7} .
114+
115+
- name: Push Docker image to Quay.io
114116
if: github.repository == 'mcruzdev/timeless'
115-
uses: buildpacks/github-actions/[email protected]
116-
117-
- name: Build and publish WhatsApp image with Buildpacks
118-
if: false # Disabled for now: we need to add chrome to the buildpack image first
119-
if: github.repository == 'mcruzdev/timeless'
120-
run: |
121-
pack build quay.io/timeless/whatsapp:${GITHUB_SHA::7} \
122-
--path . \
123-
--builder paketobuildpacks/builder-jammy-base \
124-
--buildpack paketo-buildpacks/nodejs \
125-
--publish
117+
run: docker push quay.io/timeless/whatsapp:${GITHUB_SHA::7}

whatsapp/Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM node:20-slim
2+
3+
# Install dependencies for Chromium
4+
RUN apt-get update && apt-get install -y \
5+
chromium \
6+
fonts-liberation \
7+
libasound2 \
8+
libatk-bridge2.0-0 \
9+
libatk1.0-0 \
10+
libatspi2.0-0 \
11+
libcups2 \
12+
libdbus-1-3 \
13+
libdrm2 \
14+
libgbm1 \
15+
libgtk-3-0 \
16+
libnspr4 \
17+
libnss3 \
18+
libx11-xcb1 \
19+
libxcomposite1 \
20+
libxdamage1 \
21+
libxfixes3 \
22+
libxrandr2 \
23+
xdg-utils \
24+
ca-certificates \
25+
--no-install-recommends \
26+
&& rm -rf /var/lib/apt/lists/*
27+
28+
# Set Chromium path for Puppeteer/wwebjs
29+
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
30+
ENV CHROMIUM_PATH=/usr/bin/chromium
31+
32+
33+
WORKDIR /app
34+
35+
# Copy package files
36+
COPY package*.json ./
37+
38+
# Install Node.js dependencies
39+
RUN npm install
40+
41+
# Copy application source
42+
COPY . .
43+
44+
CMD ["node", "src/index.js"]

0 commit comments

Comments
 (0)