-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
68 lines (63 loc) · 1.5 KB
/
.gitlab-ci.yml
File metadata and controls
68 lines (63 loc) · 1.5 KB
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
stages:
- build
- deploy
before_script:
- hostname
- python3 --version
deploy-revpi-tt:
only:
- main
stage: deploy
tags:
- revpi104544
- shell
script:
- echo "$ENV_CONFIG" > .env
- chmod +x install.sh
- ./install.sh --force
#deploy-revpi-mb:
# only:
# - main
# stage: deploy
# tags:
# - revpi120532
# - shell
# script:
# - echo "$ENV_CONFIG" > .env
# - chmod +x install.sh
# - ./install.sh --force
variables:
# DinD setup
DOCKER_TLS_CERTDIR: ""
# Tags to push
IMAGE_LATEST: "$CI_REGISTRY_IMAGE:latest"
IMAGE_SHA: "$CI_REGISTRY_IMAGE:${CI_COMMIT_SHORT_SHA}"
build_and_push:
stage: build
image: docker:24.0.5
tags:
- cijobs
- docker
services:
- name: docker:24.0.5-dind
command: ["--mtu=1460"] # optional; helps in some runners
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
before_script:
- echo "Logging in to $CI_REGISTRY as $CI_REGISTRY_USER"
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
- docker info
script:
# Build the image; pass API port if your Dockerfile uses it at build-time
- |
echo "Building $IMAGE_LATEST and $IMAGE_SHA"
if [ -n "$VITE_API_PORT" ]; then
docker build \
--build-arg VITE_API_PORT="$VITE_API_PORT" \
-t "$IMAGE_LATEST" -t "$IMAGE_SHA" .
else
docker build -t "$IMAGE_LATEST" -t "$IMAGE_SHA" .
fi
# Push both tags
- docker push "$IMAGE_LATEST"
- docker push "$IMAGE_SHA"