Skip to content

Commit

Permalink
Initial docker compose build github action
Browse files Browse the repository at this point in the history
  • Loading branch information
mtauraso committed Nov 6, 2024
1 parent 7593b17 commit e580004
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
68 changes: 68 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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/[email protected]
with:
compose-file: "./docker-compose.yml"
services: "tom"
up-flags: "--remove-orphans --attach migratedb"

- 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
4 changes: 3 additions & 1 deletion tom_desc/fastdb_dev/DataTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
from rest_framework.settings import api_settings

_logger = logging.getLogger("fastdb_queries")
_logout = logging.FileHandler( pathlib.Path( os.getenv('LOGDIR'), "/logs" ) / "fastdb_queries.log" )
_log_path = pathlib.Path( os.environ.get('LOGDIR',"."), "/logs" )
_log_path.mkdir(parents=True, exist_ok=True)
_logout = logging.FileHandler( _log_path / "fastdb_queries.log" )
_logger.addHandler( _logout )
_formatter = logging.Formatter( f'[%(asctime)s - %(levelname)s] - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S' )
Expand Down

0 comments on commit e580004

Please sign in to comment.