Skip to content

Commit

Permalink
Merge pull request #1 from entando/IT-339-busybox-init-container
Browse files Browse the repository at this point in the history
IT-339 busybox init container
  • Loading branch information
pietrangelo authored May 18, 2023
2 parents 07f2bcc + 665edf5 commit d43e589
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/pr-title-checker-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"LABEL": {
"name": "Wrong PR name",
"color": "ec8400"
},
"CHECKS": {
"regexp": "[A-Z]{2,5}-[0-9]{1,5}"
},
"MESSAGES": {
"success": "All OK",
"failure": "Failing PR test",
"notice": "Please check the naming convention rules for naming PRs"
}
}
83 changes: 83 additions & 0 deletions .github/workflows/multiarch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: "Entando CI Docker images"

on:
pull_request_target:
types:
- opened
- synchronize
- edited
- labeled
- unlabeled
branches:
- develop
- release/*
push:
tags:
- "v*"
branches:
- develop
- release/*
- ENG-*
- ENGPM-*
- IT-*

permissions: write-all

jobs:
docker-buildx:
name: Buildx
runs-on: ubuntu-latest
steps:
- name: Check PR
id: check-pr
uses: thehanimo/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: false
configuration_path: ".github/pr-title-checker-config.json"

- name: Checkout
uses: actions/checkout@v3

- name: Docker meta-keycloak
id: meta-keycloak
uses: docker/metadata-action@v4
with:
# List of Docker Images to use as base name for tags
images: |
entando/busybox-cds
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr,value={{head_ref}}
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,event=pr,value={{head_ref}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.ENTANDO_OPT_DOCKER_USERNAME }}
password: ${{ secrets.ENTANDO_OPT_DOCKER_PASSWORD }}

- name: Build busybox
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta-keycloak.outputs.tags }}
labels: ${{ steps.meta-keycloak.outputs.labels }}
platforms: linux/amd64,linux/arm64
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM busybox:1.36.0

ENV REPO_PATH="https://raw.github.com/entando-ps/cds/entando720/entando-data/" \
ARCHIVE_NAME="entando720.tar.gz" \
FORCE_CDS=false

COPY --chmod=0755 init.sh /init.sh

ENTRYPOINT [ "/init.sh" ]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# entando-init-busybox-cds
Repository to manage the configuration of the CDS init container based on busybox

## Environment Variables

| Name | Default Value | Description |
|-----------|----------------------------------------------------------------|-------------------------------------------------------------|
| REPO_PATH | https://raw.github.com/entando-ps/cds/entando720/entando-data/ | The path of the GitHub repository used to store the archive |
| ARCHIVE_NAME | entando720.tar.gz | The name of the archive containing all the Entando static resources |
| FORCE_CDS | false | Needed to force the overwriting of the volume |

19 changes: 19 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env sh
set -xe

DIRECTORY="/entando-data/public"
FINAL_PATH="$REPO_PATH$ARCHIVE_NAME"

if [ ! -d "$DIRECTORY" ]; then
wget --no-check-certificate "$FINAL_PATH" -P /tmp
tar -xf /tmp/"$ARCHIVE_NAME" -C /
rm /tmp/"$ARCHIVE_NAME"
echo "entando-data has been initialized correctly"
elif "$FORCE_CDS"; then
wget --no-check-certificate "$FINAL_PATH" -P /tmp
tar -xf /tmp/"$ARCHIVE_NAME" -C /
rm /tmp/"$ARCHIVE_NAME"
echo "entando-data has been overwritten correctly"
else
echo "entando-data is already in place..."
fi

0 comments on commit d43e589

Please sign in to comment.