-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
54 lines (44 loc) · 1.33 KB
/
.gitlab-ci.yml
File metadata and controls
54 lines (44 loc) · 1.33 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
image:
name: amazon/aws-cli
entrypoint: ['']
variables:
ECR_REPOSITORY: algopa-problem
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ''
services:
- docker:dind
before_script:
- amazon-linux-extras install docker
- aws --version
- docker --version
- aws ecr get-login-password --region "${AWS_DEFAULT_REGION}" | docker login --username AWS --password-stdin "${ECR_REGISTRY}"
- IMAGE_TAG="$(echo $CI_COMMIT_SHA | head -c 8)"
stages:
- build
develop:
stage: build
script:
- docker pull "$ECR_REGISTRY/$ECR_REPOSITORY:develop" || true
- docker build --cache-from "$ECR_REGISTRY/$ECR_REPOSITORY:develop" -t "$ECR_REGISTRY/$ECR_REPOSITORY:develop" -f dockerfile.dev .
- docker push "$ECR_REGISTRY/$ECR_REPOSITORY:develop"
only:
refs:
- develop
changes:
- src/**/*
- pakcage.json
- dockerfile.dev
prodcution:
stage: build
script:
- docker pull "$ECR_REGISTRY/$ECR_REPOSITORY:latest" || true
- docker build --cache-from "$ECR_REGISTRY/$ECR_REPOSITORY:latest" -t "$ECR_REGISTRY/$ECR_REPOSITORY:latest" -t "$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" .
- docker push "$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
- docker push "$ECR_REGISTRY/$ECR_REPOSITORY:latest"
only:
refs:
- main
changes:
- src/**/*
- pakcage.json
- dockerfile