-
Notifications
You must be signed in to change notification settings - Fork 9
93 lines (93 loc) · 2.95 KB
/
dockerize.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Deploy deeplinks app
on:
push:
branches: [ main ]
paths-ignore:
- 'postgresql/**'
workflow_dispatch:
defaults:
run:
working-directory: ./
env:
MIGRATIONS_ID_TYPE_SQL: bigint
MIGRATIONS_HASURA_PATH: localhost:8080
MIGRATIONS_HASURA_SSL: 0
MIGRATIONS_HASURA_SECRET: myadminsecretkey
MIGRATIONS_DEEPLINKS_URL: http://host.docker.internal:3006
JWT_SECRET: '{"type":"HS256","key":"3EK6FD+o0+c7tzBNVfjpMkNDi2yARAAKzQlk8O2IKoxQu4nF7EdAh8s3TwpHwrdWT6R"}'
jobs:
dockerize:
name: dockerize
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 18
- name: ci
run: npm ci
- name: build
run: npm run package:build
- name: docker-ver backup dir
run: mkdir backup
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: deepf/deeplinks
- name: build docker image for
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: docker init
run: cd local/actions && docker-compose -p deep up -d
- name: docker logs deep-links
run: docker logs deep-links
- name: migrate
run: npm run migrate
- name: snapshot:create
run: 'npm run snapshot:create'
- name: docker-ver backup volume
run: docker run --rm --volumes-from deep-postgres -v $(pwd):/temp ubuntu tar -c -v -C /var/lib/postgresql -f /temp/backup/volume.tar ./data
- name: docker-ver backup migrations log
run: cp .migrate backup/.migrate
- name: Extract metadata (tags, labels) for Docker
id: meta_push
uses: docker/metadata-action@v3
with:
images: deepf/deeplinks
- name: build docker image and push
id: docker_build_push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta_push.outputs.tags }}
labels: ${{ steps.meta_push.outputs.labels }}
- name: Image digest
run: echo ${{ steps.docker_build_push.outputs.digest }}
- name: Collect Docker Logs
if: failure()
uses: jwalton/[email protected]
with:
dest: './logs'
- name: Tar logs
if: failure()
run: tar cvzf ./logs.tgz ./logs
- name: Upload logs to GitHub
if: failure()
uses: actions/upload-artifact@master
with:
name: logs.tgz
path: ./logs.tgz