Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Docker Publish

on:
push:
branches: [master, main]
tags: ['v*']
pull_request:
branches: [master, main]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=,suffix=,format=short

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
20 changes: 15 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
FROM node:22-bookworm
FROM node:22-bookworm-slim

WORKDIR /app

# Install dependencies for native modules
RUN apt-get update && apt-get install -y \
# Install dependencies for native modules and prebuilt-tdlib
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libvips-dev \
python3 \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*

# Copy package files
COPY package*.json ./

# Install dependencies
# Install dependencies (prebuilt-tdlib will download TDLib binary automatically)
RUN npm install --omit=dev

# Copy source
# Verify TDLib binary is present
RUN ls -la node_modules/prebuilt-tdlib/

# Copy source code
COPY . .

# Create non-root user for security
RUN groupadd -r quotly && useradd -r -g quotly quotly \
&& chown -R quotly:quotly /app
USER quotly

# Default command (overridden in docker-compose)
CMD ["node", "updates-collector.js"]