Files
baclight/.github/workflows/docker.yml
T
dependabot[bot] 1125cee546 Bump docker/setup-buildx-action from 2 to 3
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-12 22:23:37 -07:00

59 lines
1.3 KiB
YAML

name: Docker
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
TEST_TAG: rails-on-docker:test
jobs:
build-and-test-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./production.Dockerfile
push: false
load: true
tags: ${{ env.TEST_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Inspect
run: |
docker image inspect ${{ env.TEST_TAG }}
- name: Start
run: |
docker run -d --rm --name=rails-on-docker --env SECRET_KEY_BASE=dummy ${{ env.TEST_TAG }}
- name: Logs
run: |
sleep 20
docker logs rails-on-docker
- run: |
docker container ls
- name: Check Health
run: |
HEALTH_STATUS=$(docker inspect --format='{{.State.Status}}' rails-on-docker);
echo "$HEALTH_STATUS"
if [ "$HEALTH_STATUS" != "running" ]; then
exit 1
fi