Merge pull request #1 from CUBETIQ/master

Add GitHub Workflows and Update
This commit is contained in:
Sambo Chea 2021-07-14 15:22:31 +07:00 committed by GitHub
commit edfb7edf36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 6 deletions

15
.github/workflows/main.yml vendored Normal file
View File

@ -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

View File

@ -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"]

View File

@ -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 <sombochea@cubetiqs.com>

View File

@ -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'
@ -32,3 +30,6 @@ inputs:
runs:
using: 'docker'
image: 'Dockerfile'
branding:
color: 'yellow'
icon: 'box'

View File

@ -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`"