-
Notifications
You must be signed in to change notification settings - Fork 20
59 lines (59 loc) · 2.25 KB
/
h2.yml
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
name: h2
on:
push:
paths:
- 'h2/Dockerfile'
- '.github/workflows/h2.yml'
jobs:
test-h2:
name: test h2
if: github.event.inputs.trigger == ''
|| !startsWith(github.event.inputs.trigger, 'm')
|| !startsWith(github.event.inputs.trigger, 'M')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v3
with:
path: |
~/.docker
key: ${{ runner.os }}-h2
- run: if [[ "" != `docker ps -aq` ]] ; then docker rm -f -v `docker ps -aq` ; fi
- uses: actions/setup-node@v3
with:
node-version: 18.2.0
- run: sudo apt install -y httpie
- run: docker build --no-cache -t daggerok/h2 -f $GITHUB_WORKSPACE/h2/Dockerfile .
#- run: |
# mkdir -p /tmp/h2/data ; docker run --rm -d -p 8082:8082 -p 9092:9092 --name h2 -v /tmp/h2/data:/home/h2/data \
# --health-start-period=1s --health-retries=1111 --health-interval=1s --health-timeout=5s \
# --health-cmd='curl 127.0.0.1:8082 || exit 1' \
# daggerok/h2
- run: mkdir -p /tmp/h2/data ; docker run --rm -d -p 8082:8082 -p 9092:9092 --name h2 -v /tmp/h2/data:/home/h2/data daggerok/h2
- run: while [[ $(docker ps -n 1 -q -f health=healthy -f status=running | wc -l) -lt 1 ]] ; do sleep 3 ; echo -n '.' ; done ; echo 'H2 is ready.'
- run: npm_config_yes=true npx wait-port 8082 9092
- run: http --ignore-stdin :8082
- run: docker stop h2
push-h2:
name: Push daggerok/h2 Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: daggerok/h2
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
file: "./h2/Dockerfile"
context: .
push: true
tags: ${{ steps.meta.outputs.tags }},${{ secrets.DOCKER_USERNAME }}/h2:latest
labels: ${{ steps.meta.outputs.labels }}