-
Notifications
You must be signed in to change notification settings - Fork 36
87 lines (79 loc) · 2.79 KB
/
build-docker-slim.yml
File metadata and controls
87 lines (79 loc) · 2.79 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: build-docker-slim
on:
workflow_call:
inputs:
version:
type: string
description: The release semver version
required: true
channel:
type: string
description: The release channel (latest-rc, nightly, dev, etc)
required: true
jobs:
buildPush:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION_OVERRIDE || 'lts/*' }}
cache: yarn
# for whatever version got passed in, we need the download url for the linux xz tarball
- name: Collect version info
uses: salesforcecli/github-workflows/.github/actions/versionInfo@main
id: version-info
with:
version: ${{ inputs.version }}
npmPackage: '@salesforce/cli'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb
- name: Log in to Docker Hub
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: salesforce/cli
- name: Build and push Docker image
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25
with:
context: .
push: true
labels: ${{ steps.meta.outputs.labels }}
file: dockerfiles/Dockerfile_slim
build-args: |
DOWNLOAD_URL=${{ steps.version-info.outputs.url }}
tags: salesforce/cli:${{ inputs.channel }}-slim, salesforce/cli:${{ steps.version-info.outputs.version }}-slim
verify:
needs: buildPush
runs-on: ubuntu-latest
container:
image: salesforce/cli:${{ inputs.version }}-slim
steps:
- name: verify sf, java
# without bash this will fail. Not sure what the default shell is but it doesn't like the [[(())]] bashism
shell: bash
run: |
set -e
sf version
SF_CLI_VERSION=$(sf version)
JAVA_VERSION=$(java --version | head -n 1)
if [[ ((`echo $SF_CLI_VERSION | grep -c "@salesforce/cli/"` > 0))]]
then
echo "sf installed -" $SF_CLI_VERSION
else
echo "The sf installation could not be verified"
exit 1
fi
if [[ ((`echo $JAVA_VERSION | grep -c "openjdk"` > 0))]]
then
echo "Java installed -" $JAVA_VERSION
else
echo "The Java installation could not be verified"
exit 1
fi