OpenStock is an open-source alternative to expensive market platforms. Track real-time prices, set personalized alerts, and explore detailed company insights — built openly, for everyone, forever free.
feat(docker): publish a prebuilt image to GHCR, move to Node 22
ravixalgorithmf4f3946229a1
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.ymlnew file mode 100644index 0000000..1f1739c--- /dev/null+++ b/.github/workflows/docker-image.yml@@ -0,0 +1,47 @@+# Publishes the self-hosting image to GitHub Container Registry. The build needs no secrets (every variable is+# read at runtime), so nothing private ends up in the image.+name: Docker image++on:+ push:+ branches: [main]+ tags: ['v*']+ workflow_dispatch:++permissions:+ contents: read+ packages: write++concurrency:+ group: docker-image-${{ github.ref }}+ cancel-in-progress: true++jobs:+ publish:+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ - uses: docker/setup-qemu-action@v3+ - uses: docker/setup-buildx-action@v3+ - uses: docker/login-action@v3+ with:+ registry: ghcr.io+ username: ${{ github.actor }}+ password: ${{ secrets.GITHUB_TOKEN }}+ - id: meta+ uses: docker/metadata-action@v5+ with:+ images: ghcr.io/open-dev-society/openstock+ tags: |+ type=raw,value=latest,enable={{is_default_branch}}+ type=semver,pattern={{version}}+ type=sha,format=short+ - uses: docker/build-push-action@v6+ with:+ context: .+ platforms: linux/amd64,linux/arm64+ push: true+ tags: ${{ steps.meta.outputs.tags }}+ labels: ${{ steps.meta.outputs.labels }}+ cache-from: type=gha+ cache-to: type=gha,mode=maxdiff --git a/Dockerfile b/Dockerfileindex 0ea471b..49bbc65 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,5 +1,5 @@-# Use official Node.js 20 Alpine image as base-FROM node:20-alpine+# Node 22 LTS (Node 20 reached end of life in April 2026)+FROM node:22-alpine# Set working directoryWORKDIR /app@@ -9,8 +9,8 @@ COPY package*.json ./# Uncomment the next line if you use pnpm and have pnpm-lock.yaml# COPY pnpm-lock.yaml ./-# Install dependencies (choose npm or pnpm)-RUN npm install+# Install exactly what package-lock.json pins (choose npm or pnpm)+RUN npm ci# If using pnpm, replace with:# RUN npm install -g pnpm && pnpm installdiff --git a/README.md b/README.mdindex 161fada..357310e 100644--- a/README.md+++ b/README.md@@ -224,6 +224,12 @@ docker compose up -d --build- App: http://localhost:3000- MongoDB is only reachable inside the Docker network, at host mongodb:27017. It isn't published on your machine.+Prefer not to build? Every push to `main` publishes a prebuilt image (amd64 and arm64) to GitHub Container Registry. In `docker-compose.yml`, replace `build: context: .` under `openstock` with:+```yaml+ image: ghcr.io/open-dev-society/openstock:latest+```+then run `docker compose pull && docker compose up -d`. Tags: `latest` (main), `sha-<commit>`, and `x.y.z` for releases. The image contains no secrets; all configuration comes from your `.env` at runtime.+Notes- The app service depends_on the mongodb service.- The MongoDB root password comes from `MONGO_ROOT_PASSWORD` (default `example`, only applied when the volume is first created); authSource=admin is required on the connection string for root.