Skip to content

Initial docker compose build github action #7

Initial docker compose build github action

Initial docker compose build github action #7

Workflow file for this run

name: Build Docker image
# Shamelessly cribbed from https://docs.docker.com/build/ci/github-actions/test-before-push/
# with minor modifications
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
TEST_TAG: user/app:test
LATEST_TAG: user/app:latest
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run docker-compose
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: "./docker-compose.yml"
services: "tom"
up-flags: "--remove-orphans"
- name: Test
run: docker run --network tom_desc_default appropriate/curl -s --retry 10 --retry-connrefused http://tom:8080/
# test2:
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# #container_dir: [ docker_kafka, docker_postgres, docker_server]
# container_dir: [ docker_kafka]
# steps:
# - uses: actions/checkout@v4
# - name: Set up Docker Buildx
# id: buildx
# uses: docker/setup-buildx-action@master
# - name: Cache Docker layers
# uses: actions/cache@v2
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{matrix.container_dir}}-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-buildx-${{matrix.container_dir}}
# - name: Build and push images
# uses: docker/build-push-action@v2
# with:
# push: false
# load: true
# builder: ${{ steps.buildx.outputs.name }}
# tags: repo/${{matrix.container_dir}}:latest
# file: ${{matrix.container_dir}}/Dockerfile
# context: .
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache
# stack:
# needs: test2
# runs-on: ubuntu-latest
# steps:
# - name: Build the stack
# run: COMPOSE_DOCKER_CLI_BUILD=1 docker-compose build