ffs
Some checks failed
Build and Push Docker Image / build (push) Failing after 0s

This commit is contained in:
Christoph Haas 2026-02-04 22:51:17 +01:00
parent 74e3264562
commit 4bbbfcc577

View file

@ -1,70 +1,55 @@
# This workflow will build and test the Rails application
name: Build and Test Rails Application
name: Build and Push Docker Image
on:
push:
branches: [ main ]
branches:
- main
pull_request:
branches: [ main ]
branches:
- main
env:
DOCKER_TLS_CERTDIR: /certs
RAILS_ENV: production
# GitHub/Forgejo equivalent of CI_REGISTRY_IMAGE + commit refs
CONTAINER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ github.sha }}
jobs:
build:
runs-on: docker
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: debshots_test
docker:
image: docker:20.10.16-dind
options: --privileged
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
- 2375:2375
env:
DOCKER_TLS_CERTDIR: /certs
steps:
- uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.4
- name: Set up Docker CLI
uses: docker/setup-buildx-action@v3
- name: Install dependencies
- name: Docker info
run: docker info
- name: Log in to container registry
run: |
gem install bundler
bundle install
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login \
-u "${{ secrets.REGISTRY_USER }}" \
--password-stdin \
${{ secrets.REGISTRY_URL }}
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install Yarn
run: npm install -g yarn
- name: Install Node.js dependencies
run: yarn install
- name: Set up database
- name: Build Docker image
run: |
bundle exec rails db:create db:migrate
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432/debshots_test
docker build -t "$CONTAINER_IMAGE" .
docker tag "$CONTAINER_IMAGE" "${{ secrets.REGISTRY_IMAGE }}:latest"
- name: Run tests
run: bundle exec rails test
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432/debshots_test
- name: Build assets
run: bundle exec rails assets:precompile
env:
RAILS_ENV: production
- name: Push Docker images
run: |
docker push "$CONTAINER_IMAGE"
docker push "${{ secrets.REGISTRY_IMAGE }}:latest"