Skip to content

Commit

Permalink
ci(docker-build): split data science layers to new image
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Mar 30, 2024
1 parent 7c9e027 commit 75ca9e6
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 20 deletions.
24 changes: 15 additions & 9 deletions .github/docker/layer-35.00-tools-tailscale.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,23 @@ main() {
time apt install -y "${PACKAGES[@]}" || track_errors
printf "\n"

declare -a GO_PKGS
GO_PKGS=(
golang.zx2c4.com/wireguard@latest
)
if command -v go >&/dev/null; then
declare -a GO_PKGS
GO_PKGS=(
golang.zx2c4.com/wireguard@latest
)

declare url
for url in "${GO_PKGS[@]}"; do
echo Running: go install "${url}"
go install "${url}" || track_errors
declare url
for url in "${GO_PKGS[@]}"; do
echo Running: go install "${url}"
go install "${url}" || track_errors
printf "\n"
done
else
printf "\n"
printf "Go not found, skipping installation of extra packages.\n"
printf "\n"
done
fi

layer_end "${0}" "$@"

Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ on: # yamllint disable-line rule:truthy
workflow_dispatch:
pull_request:

env:
IMAGE_NAME: ci-generic-debian

defaults:
run:
shell: bash
Expand Down Expand Up @@ -103,43 +100,47 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest"]
image:
- ci-generic-debian
- ci-anaconda-debian
runs-on: "${{ matrix.os }}"
needs: [stage1]
if: needs.stage1.outputs.docs_changed == 'True'
outputs:
tag_date: ${{ steps.setup_image_info.outputs.tag_date }}
steps:
- name: Setup Env [${{ matrix.os }}]
- name: Setup Env [${{ matrix.os }} - ${{ matrix.image }}]
id: setup_image_info
run: |-
tag_date="$(date +%Y%m%d)"
printf "%s=%s\n" "tag_date" "${tag_date}" >> "${GITHUB_OUTPUT}"
- name: Docker Build Checkout [${{ matrix.os }}]
- name: Docker Build Checkout [${{ matrix.os }} - ${{ matrix.image }}]
uses: actions/checkout@v3
- name: Login to Docker Hub [${{ matrix.os }}]
- name: Login to Docker Hub [${{ matrix.os }} - ${{ matrix.image }}]
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx [${{ matrix.os }}]
- name: Set up Docker Buildx [${{ matrix.os }} - ${{ matrix.image }}]
uses: docker/setup-buildx-action@v2
- name: Build and push [${{ matrix.os }}]
- name: Build and push [${{ matrix.os }} - ${{ matrix.image }}]
uses: docker/build-push-action@v4
with:
context: .
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 }}
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:latest,${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ steps.setup_image_info.outputs.tag_date }}
stage3:
name: Docker Build Check
env:
ORG: ${{ secrets.DOCKERHUB_USERNAME }}
IMAGE_NAME: ci-generic-debian
strategy:
matrix:
os:
- vpayno/ci-generic-debian:latest
- vpayno/ci-generic-debian:${{ needs.stage2.outputs.tag_date }}
- vpayno/ci-anaconda-debian:latest
- vpayno/ci-anaconda-debian:${{ needs.stage2.outputs.tag_date }}
runs-on: ubuntu-latest
container: ${{ matrix.os }}
needs: [stage2]
Expand All @@ -149,7 +150,10 @@ jobs:
printf "%s\n" "Hello World!"
- name: Docker Build Summary [${{ matrix.os }}]
run: |-
ORG_IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}"
IMAGE_NAME="${{ matrix.os }}"
IMAGE_NAME="${IMAGE_NAME##*/}"
IMAGE_NAME="${IMAGE_NAME%%:*}"
ORG_IMAGE="${{ secrets.DOCKERHUB_USERNAME }}/${IMAGE_NAME}"
TOKEN="$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:${ORG_IMAGE}:pull" | jq -r .access_token)"
{
printf "Docker Hub Image Info\n"
Expand Down
54 changes: 54 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@ RUN bash .github/docker/layer-10.00-exercism-gcc_clang_llvm.sh ci-generic-debian

RUN bash .github/docker/layer-14.00-exercism-tools.sh ci-generic-debian && : 20240101-000

RUN bash .github/docker/layer-99.00-summary.sh ci-generic-debian && : 20231103-000

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

RUN rm -rvf /.github

SHELL ["bash", "-c"]

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

# Extra args
CMD []

# =============================================================================

From ci-generic-base As ci-generic-debian

COPY .github/docker /.github/docker

COPY .github/citools/ /.github/citools/

RUN bash .github/docker/layer-15.00-exercism-rust.sh ci-generic-debian && : 20231103-000

RUN bash .github/docker/layer-16.00-exercism-go.sh ci-generic-debian && : 20240111-000
Expand All @@ -36,6 +60,36 @@ RUN bash .github/docker/layer-18.00-exercism-python.sh ci-generic-debian && : 20

RUN bash .github/docker/layer-19.00-exercism-gleam.sh ci-generic-debian && : 20240322-000

RUN bash .github/docker/layer-25.00-tools-vscode.sh ci-generic-debian && : 20240102-000

RUN bash .github/docker/layer-35.00-tools-tailscale.sh ci-generic-debian && : 20240111-000

RUN bash .github/docker/layer-99.00-summary.sh ci-generic-debian && : 20231103-000

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

RUN rm -rvf /.github

SHELL ["bash", "-c"]

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

# Extra args
CMD []

# =============================================================================

From ci-generic-base As ci-anaconda-debian

COPY .github/docker /.github/docker

COPY .github/citools/ /.github/citools/

RUN bash .github/docker/layer-18.00-exercism-python.sh ci-generic-debian && : 20240322-000

RUN bash .github/docker/layer-20.00-exercism-r.sh ci-generic-debian && : 20240328-000

RUN bash .github/docker/layer-25.00-tools-vscode.sh ci-generic-debian && : 20240102-000
Expand Down

0 comments on commit 75ca9e6

Please sign in to comment.