diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ee26ae9 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,15 @@ +name: CI + +on: + push: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Starter Docker Test + uses: cubetiq/starter-docker-actions@v1 + with: + run: docker version diff --git a/Dockerfile b/Dockerfile index 3450511..cb90a71 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,8 @@ FROM docker:latest RUN apk add bash -COPY entrypoint.sh /entrypoint.sh +COPY ./entrypoint.sh /entrypoint.sh + +RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 9a3fb8f..fd4fab2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,38 @@ # Starter Docker - GitHub Actions -- Run actions with docker + +- Run actions with docker (latest version) - Quick and easy to use +- Support custom registry +- Support custom shell and commands + +# Usage + +```yaml +- name: Starter Docker + uses: CUBETIQ/starter-docker-actions@v1 +``` + +# Example Action + +```yaml +name: CI + +on: + push: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Starter Docker Test + uses: cubetiq/starter-docker-actions@v1 + with: + shell: sh + run: docker version +``` # Contributors -- Sambo Chea \ No newline at end of file + +- Sambo Chea diff --git a/action.yml b/action.yml index f21ddc4..f982460 100644 --- a/action.yml +++ b/action.yml @@ -1,7 +1,5 @@ name: 'Starter Docker' description: 'Starter Docker GitHub Action for CUBETIQ and docker environment.' -color: 'yellow' -icon: 'box' inputs: image: description: 'Docker image name' @@ -31,4 +29,7 @@ inputs: required: false runs: using: 'docker' - image: 'Dockerfile' \ No newline at end of file + image: 'Dockerfile' +branding: + color: 'yellow' + icon: 'box' \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index d83330a..970a464 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -10,4 +10,16 @@ if [ ! -z $INPUT_DOCKER_NETWORK ]; then INPUT_OPTIONS="$INPUT_OPTIONS --network $INPUT_DOCKER_NETWORK" fi +if [ -z $INPUT_SHELL ]; +then INPUT_SHELL=sh +fi + +if [ -z $INPUT_IMAGE ]; +then INPUT_IMAGE=docker +fi + +if [ -z $semicolon_delimited_script ]; +then semicolon_delimited_script="echo $(whoami)" +fi + exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`" \ No newline at end of file