forked from chrisleekr/binance-trading-bot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
94 lines (90 loc) · 2.94 KB
/
.gitlab-ci.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
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
94
stages:
- testing
- build production
cache:
key: '$CI_PIPELINE_ID'
paths:
- /root/.cache
- /root/.npm
- node_modules
testing:
stage: testing
image: node:14
allow_failure: true
script:
- npm install
- npm run lint
- npm run test
production:
stage: build production
image: docker:20-dind
services:
- name: docker:20-dind
alias: docker
command: ['--tls=false']
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ''
tags:
- dind
only:
- master
- development
before_script:
- apk add curl git jq
- mkdir -p ~/.docker/cli-plugins/
- BUILDX_LATEST_BIN_URI=$(curl -s -L
https://api.github.com/repos/docker/buildx/releases/latest | jq
--raw-output '.assets[] | select(.name | contains ("linux-amd64")) |
.browser_download_url')
- curl -s -L ${BUILDX_LATEST_BIN_URI} -o ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER"
--password-stdin $CI_REGISTRY
- docker context create dind
- docker buildx create --driver docker-container --use dind
script:
- PACKAGE_VERSION=$(grep -m1 version package.json | cut -c 15- | rev | cut
-c 3- | rev)
- GIT_HASH=$(git rev-parse --short HEAD)
- docker buildx build --progress plain --platform
linux/amd64,linux/arm/v7,linux/arm64 --build-arg
PACKAGE_VERSION=$PACKAGE_VERSION --build-arg GIT_HASH=$GIT_HASH
--build-arg NODE_ENV=production --target production-stage --pull --tag
$REGISTRY_DOMAIN/chrisleekr/binance-trading-bot:latest --push .
production-tradingview:
stage: build production
image: docker:20-dind
services:
- name: docker:20-dind
alias: docker
command: ['--tls=false']
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ''
tags:
- dind
only:
- master
- development
before_script:
- apk add curl git jq
- mkdir -p ~/.docker/cli-plugins/
- BUILDX_LATEST_BIN_URI=$(curl -s -L
https://api.github.com/repos/docker/buildx/releases/latest | jq
--raw-output '.assets[] | select(.name | contains ("linux-amd64")) |
.browser_download_url')
- curl -s -L ${BUILDX_LATEST_BIN_URI} -o ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER"
--password-stdin $CI_REGISTRY
- docker context create dind
- docker buildx create --driver docker-container --use dind
script:
- docker buildx build --progress plain --platform linux/amd64,linux/arm/v7
--pull --tag $REGISTRY_DOMAIN/chrisleekr/binance-trading-bot:tradingview
--push ./tradingview