Skip to content

Merge pull request #133 from simonsobs/dependabot/pip/ci/latest/tomli… #154

Merge pull request #133 from simonsobs/dependabot/pip/ci/latest/tomli…

Merge pull request #133 from simonsobs/dependabot/pip/ci/latest/tomli… #154

Workflow file for this run

name: Build and test Docker image
# This workflow builds a Docker image and runs a container to test the image.
# Five seconds after it starts the container, it prints the logs of the container.
# Then, it checks if the container is running. If the container is not running, the
# workflow exits with an error.
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
IMAGE_NAME: ${{ github.repository }}
jobs:
build-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
tags: ${{ env.IMAGE_NAME }}:latest
- name: List Docker images
run: docker images
- name: Run Docker container
run: |
docker run --name test-container -d ${{ env.IMAGE_NAME }}:latest
sleep 5
docker logs test-container
if [ "$(docker ps -f name=test-container -q)" = "" ]; then
echo "Container is not running."
exit 1
fi
docker stop test-container