-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
75 lines (61 loc) · 1.42 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
stages:
- build
build-frontend:
stage: build
when: manual
script:
- cd frontend
- npm i
- npm run build
artifacts:
name: webui
paths:
- frontend/build
expire_in: 1 week
tags:
- linux
build-linux:
stage: build
when: manual
script:
- "cd backend"
- "mkdir static"
- "cargo test"
- "cp -r ../webui/build/. static/"
- "ls -liah static/"
- "cp -f ../favicon.png static/"
- "cargo test"
- "cargo build --release"
- "cd .."
- "cp backend/pw.yml-dist ."
- "cp target/release/backend pw"
- "eu-elfcompress pw"
- "strip pw"
- "upx -9 --lzma pw || true"
- 'VERSION=$(cat backend/Cargo.toml | grep version | head -1 | cut -d "\"" -f 2)'
- "echo $VERSION > build-version"
artifacts:
name: pw-app
paths:
- build-version
- pw
- README.md
- pw.yml-dist
- docs
expire_in: 1 week
build-image:
stage: build
when: manual
image: docker:20.10.16
services:
- docker:20.10.16-dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- APP_VERSION=`cat Cargo.toml | grep "version = " | head -1 | cut -d "=" -f2 | tr -d '"' | tr -d ' '`
- DOCKER_IMAGE=$CI_REGISTRY_IMAGE:$APP_VERSION
- DOCKER_BUILDKIT=1
- docker build --progress=plain -t $DOCKER_IMAGE -f Dockerfile .
- docker push $DOCKER_IMAGE
tags:
- linux