-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(convert): export ENV vars (#411)
* feat(convert): export ENV vars We could have passed these into the "build_env:" directive, however it appears environment substitution is also allowed such as PATH=/usr/local/sbin:$PATH for that layer, which is harder to figure out. Instead just "export" them in the "run:" directive. Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com> * ci(convert): add a workflow to convert upstream repos Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com> --------- Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
- Loading branch information
Showing
5 changed files
with
100 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: "convert dockerfiles" | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
env: | ||
REGISTRY_URL: localhost:5000 | ||
|
||
jobs: | ||
ci: | ||
uses: ./.github/workflows/build.yaml | ||
with: | ||
# note >-, args needs to be strings to be used as inputs | ||
# for the reusable build.yaml workflow | ||
go-version: >- | ||
["1.20.x"] | ||
privilege-level: >- | ||
["priv"] | ||
convert: | ||
name: "convert" | ||
runs-on: ubuntu-20.04 | ||
# needs ci for the cached stacker binary | ||
needs: ci | ||
steps: | ||
- uses: benjlevesque/short-sha@v2.1 | ||
id: short-sha | ||
- uses: actions/cache@v3 | ||
id: restore-build | ||
with: | ||
path: stacker | ||
key: ${{ steps.short-sha.outputs.sha }} | ||
- name: zot registry | ||
env: | ||
ZOT_HOST: localhost | ||
ZOT_PORT: 5000 | ||
run: | | ||
# start a zot instance (minimal) | ||
podman run -p ${ZOT_PORT}:${ZOT_PORT} ghcr.io/project-zot/zot-minimal-linux-amd64:latest | ||
# check if reachable | ||
while true; do x=0; curl -f http://${REGISTRY_URL}/v2/ || x=1; if [ $x -eq 0 ]; then break; fi; sleep 1; done | ||
- name: alpine | ||
run: | | ||
export PATH=$PATH:$GITHUB_WORKSPACE | ||
git clone https://github.com/alpinelinux/docker-alpine.git | ||
chmod -R a+rwx docker-alpine | ||
cd docker-alpine | ||
mkdir -p /out | ||
chmod -R a+rwx /out | ||
stacker convert --docker-file Dockerfile --output-file stacker.yaml --substitute-file stacker-subs.yaml | ||
stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=alpine | ||
stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=alpine --skip-tls --url docker://${REGISTRY_URL} --layer alpine --tag latest | ||
rm -f stacker.yaml stacker-subs.yaml | ||
stacker clean | ||
cd $GITHUB_WORKSPACE | ||
rm -rf docker-alpine | ||
- name: elasticsearch | ||
run: | | ||
export PATH=$PATH:$GITHUB_WORKSPACE | ||
git clone https://github.com/elastic/dockerfiles.git | ||
chmod -R a+rwx dockerfiles | ||
cd dockerfiles/elasticsearch | ||
stacker convert --docker-file Dockerfile --output-file stacker.yaml --substitute-file stacker-subs.yaml | ||
stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=elasticsearch | ||
stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=elasticsearch --skip-tls --url docker://${REGISTRY_URL} --layer elasticsearch | ||
rm -f stacker.yaml stacker-subs.yaml | ||
stacker clean | ||
cd $GITHUB_WORKSPACE | ||
rm -rf dockerfiles | ||
- name: python | ||
run: | | ||
export PATH=$PATH:$GITHUB_WORKSPACE | ||
git clone https://github.com/docker-library/python.git | ||
cd python/3.11/alpine3.17 | ||
chmod -R a+rw . | ||
stacker convert --docker-file Dockerfile --output-file stacker.yaml --substitute-file stacker-subs.yaml | ||
stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=python | ||
stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=python --skip-tls --url docker://${REGISTRY_URL} --layer python --tag latest | ||
rm -f stacker.yaml stacker-subs.yaml | ||
stacker clean | ||
cd $GITHUB_WORKSPACE | ||
rm -rf python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters