-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample-pipeline.yaml
65 lines (58 loc) · 2.28 KB
/
sample-pipeline.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
version: "1.0"
stages:
- "clone"
- "build"
- "push"
- "slim"
steps:
# Cloning the repo which contains the docker file of the "bulky" (AKA Target) image
clone:
title: "Cloning repository"
type: "git-clone"
repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}'
revision: '${{CF_REVISION}}'
git: '${{gitProvider}}'
stage: "clone"
# This is going to be the target image which will be slimmed
build:
title: "Building Docker image"
stage: "build"
type: "build"
image_name: "${{imageNamespace}}/${{imageRepo}}"
working_directory: "${{clone}}"
tag: "${{imageTag}}"
dockerfile: "${{imageRepo}}/${{imageRepo}}.Dockerfile"
# This is required to use the Slim.AI platform (See: https://github.com/codefresh-contrib/slim-image-with-slimai#image-must-be-pushed-to-your-targets-connector)
push:
title: "Pushing Docker image"
stage: "push"
type: "push"
arguments:
candidate: '${{build}}'
tag: ${{imageTag}}
image_name: ${{imageNamespace}}/${{imageRepo}}
registry: ${{codefreshDockerRegistry}}
# Step which slims the target image and makes it available at: <namespace>/<repo>:<tag>-slim
slim:
title: "Slim Docker Image"
stage: "slim"
type: "freestyle"
image: "mstantoncf/slim-saas-build:latest"
cmd:
# These flags are the minimum required flags for the image to run
# There are optional flags which can be set as well.
# For all flags which are available, see: https://github.com/codefresh-contrib/slim-image-with-slimai/blob/main/README.md#usage
- "-o" # Slim organization ID (See: https://github.com/codefresh-contrib/slim-image-with-slimai#slimai-organization-id)
- ${{slimOrganizationID}}
- "-a" # Slim API Token
- ${{slimAPIToken}}
- "-c" # Slim Connector ID
- ${{slimConnectorID}}
- "-n" # Namespace of slim image target (I.e <namespace>/<repo>:<tag>)
- ${{imageNamespace}}
- "-r" # Repo of slim image target (I.e <namespace>/<repo>:<tag>)
- ${{imageRepo}}
- "-t" # Tag of slim image target (I.e <namespace>/<repo>:<tag>)
- ${{imageTag}}
- "-d" # This value is retreived automatically through the 'push' step (See: https://codefresh.io/docs/docs/pipelines/variables/#step-variables)
- ${{steps.push.imageRepoDigest}}