Skip to content

Commit

Permalink
ci(build-docker): install curl and jq before creating image summary
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Aug 13, 2023
1 parent 6e7b137 commit 4dffdd2
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 4 deletions.
45 changes: 45 additions & 0 deletions .github/docker/include
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh
#
# .github/docker/include
#
# Usage: source from layer script and call the functions
#
# Notes:
# - use sh/posix syntax only

layer_begin() {
printf "%s start\n\n" "layer_begin()"

pwd
cd "${GITHUB_WORKSPACE}" || exit
pwd
printf "\n"

printf "%s: %s\n" "$1" "$(date +%Y%m%d-%H%M%S)" >/etc/ci-image-info
cat /etc/ci-image-info
printf "\n"

time apt update
echo apt update
printf "\n"

echo apt upgrade
time apt upgrade
printf "\n"

printf "%s end\n\n" "layer_begin()"
}

layer_end() {
printf "%s start\n\n" "layer_end()"

echo apt-get clean
time apt-get clean
printf "\n"

echo rm -rf /var/lib/apt/lists/*
time rm -rf /var/lib/apt/lists/*
printf "\n"

printf "%s end\n\n" "layer_end()"
}
14 changes: 14 additions & 0 deletions .github/docker/layer-00.00-base-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

. "${GITHUB_WORKSPACE}"/include

layer_begin "$@"

PACKAGES="bash curl jq sudo tee"

echo apt install -y "${PACKAGES}"
# shellcheck disable=SC2086
time apt install -y ${PACKAGES}
printf "\n"

layer_end "$@"
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
- name: Build and push [${{ matrix.os }}]
uses: docker/build-push-action@v4
with:
context: .
context: /home/runner/work/exercism-workspace/exercism-workspace
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest,${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.setup_image_info.outputs.tag_date }}
Expand Down
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#
# Dockerfile: ci-generic-debian
# Dockerfile
#

From debian:bullseye-slim As ci-generic-base

RUN pwd

#RUN .github/docker/layer-00.00-base-dependencies.sh ci-generic-debian

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY .github/docker/entrypoint.sh /entrypoint.sh

# app + args
# Executes `entrypoint.sh` when the Docker container starts up
ENTRYPOINT ["/entrypoint.sh"]

# extra args
# CMD []
# Extra args
CMD []

0 comments on commit 4dffdd2

Please sign in to comment.