Added ci/cd
Some checks failed
Main / build-and-push-docker-image (20.x) (push) Failing after 3m22s

This commit is contained in:
2025-12-05 19:37:35 -05:00
parent 81004f59d2
commit 3b7c18a984
3 changed files with 70 additions and 0 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
node_modules

63
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,63 @@
name: Main
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
REGISTRY: gitea.lucids-cove.duckdns.org
OWNER: wkc
IMAGE_NAME: no-twitter-bot-stats
jobs:
build-and-push-docker-image:
runs-on: ubuntu-24.04
strategy:
matrix:
node-version: [20.x]
steps:
- name: "Base requirements"
run: |
# packages
apk update && apk add --no-cache git docker docker-compose nodejs gpg openssh npm ansible
# ansible collections
ansible-galaxy collection install community.general --force
ansible-galaxy collection install ansible.posix --force
- uses: actions/checkout@v4
- name: Enable Corepack
run: npm install -g corepack && corepack enable
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.OWNER }}
password: ${{ secrets.TOKEN }}
- name: Docker Hub Login
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}
- name: Build and Push Versioned Docker Image
id: build-and-push
uses: docker/build-push-action@v4
if: ${{ github.ref != 'refs/heads/main' }}
with:
context: .
push: ${{ !github.event.pull_request.head.repo.fork }}
tags: ${{ steps.meta.outputs.tags }}
- name: Build and Push Latest Docker Image
id: build-and-push-latest
uses: docker/build-push-action@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:latest

View File

@@ -2,6 +2,12 @@
FROM node:20-alpine AS base
# Enable Corepack
RUN corepack enable
# Set Yarn to the latest stable version
RUN yarn set version stable
# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.