-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (53 loc) · 1.89 KB
/
CI-docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: CI (Docker)
run-name: Docker Compose CI part
on:
workflow_call:
inputs:
mode:
description: "in which mode should be run the test"
type: string
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: ☁️ Retrieve repo
uses: actions/checkout@v3
- name: 🔧 Export compose file var (prod)
if: inputs.mode == 'prod'
run: echo "DOCKER_COMPOSE_FILE=docker-compose.yaml" >> $GITHUB_ENV
- name: 🔧 Export compose file var (dev)
if: inputs.mode == 'dev'
run: echo "DOCKER_COMPOSE_FILE=docker-compose-dev.yaml" >> $GITHUB_ENV
- name: 🔧 Setup .env
run: printf "${{ vars.SETUP_STR }}\n" | ./setup
- name: 🧹 Cleaning up previous run
run: |+
rm -rf ./volume
docker compose -f ${DOCKER_COMPOSE_FILE} down
- name: 🤖 Build ${{ inputs.mode }}
timeout-minutes: 5
run: docker compose -f ${DOCKER_COMPOSE_FILE} build
docker-run:
needs: docker-build
runs-on: ubuntu-latest
steps:
- name: ☁️ Retrieve repo
uses: actions/checkout@v3
- name: 🔧 Export compose file var (prod)
if: inputs.mode == 'prod'
run: echo "DOCKER_COMPOSE_FILE=docker-compose.yaml" >> $GITHUB_ENV
- name: 🔧 Export compose file var (dev)
if: inputs.mode == 'dev'
run: echo "DOCKER_COMPOSE_FILE=docker-compose-dev.yaml" >> $GITHUB_ENV
- name: 🔧 Setup .env
run: printf "${{ vars.SETUP_STR }}\n" | ./setup
- name: 🧹 Cleaning up previous run
run: |+
rm -rf ./volume
docker compose -f ${DOCKER_COMPOSE_FILE} down
- name: 🤖 Executing docker compose up
timeout-minutes: 5
run: docker compose -f ${DOCKER_COMPOSE_FILE} up --build -d --wait
- name: 💬 Docker compose logs
if: always()
run: docker compose logs