fix(app/action): add --rm to auto-clean docker images

This commit is contained in:
lowlighter
2022-04-24 13:17:54 -04:00
parent 5e3460fa0b
commit 1bf3b92544
7 changed files with 305 additions and 305 deletions

View File

@@ -8,7 +8,7 @@ A machine with a recent version of [docker](https://www.docker.com/) is required
The command to use is similar to the following: The command to use is similar to the following:
```shell ```shell
docker run --env INPUT_TOKEN=**** --env INPUT_USER=user --volume=/tmp:/renders ghcr.io/lowlighter/metrics:latest docker run --rm --env INPUT_TOKEN=**** --env INPUT_USER=user --volume=/tmp:/renders ghcr.io/lowlighter/metrics:latest
``` ```
To pass parameters, pass environment variable with the same name as the corresponding action option but in uppercase and prefixed with `INPUT_`. To pass parameters, pass environment variable with the same name as the corresponding action option but in uppercase and prefixed with `INPUT_`.

View File

@@ -104,7 +104,7 @@ PUBLISHED_PORT=80
And start the container using the following command: And start the container using the following command:
```shell ```shell
docker run --entrypoint="" -p=127.0.0.1:$PUBLISHED_PORT:$SERVICE_PORT --volume=$SETTINGS:/metrics/settings.json ghcr.io/lowlighter/metrics:$VERSION npm start docker run --rm --entrypoint="" -p=127.0.0.1:$PUBLISHED_PORT:$SERVICE_PORT --volume=$SETTINGS:/metrics/settings.json ghcr.io/lowlighter/metrics:$VERSION npm start
``` ```
## 4 Add images to your profile `README.md` ## 4 Add images to your profile `README.md`

View File

@@ -44,7 +44,7 @@ jobs:
- name: Screenshot markdown example - name: Screenshot markdown example
if: ${{ success() || failure() }} if: ${{ success() || failure() }}
run: | run: |
docker run --entrypoint="" --volume=/tmp:/tmp ghcr.io/lowlighter/metrics:master node /metrics/.github/scripts/markdown_example.mjs docker run --rm --entrypoint="" --volume=/tmp:/tmp ghcr.io/lowlighter/metrics:master node /metrics/.github/scripts/markdown_example.mjs
sudo mv /tmp/metrics.markdown.png /metrics_renders/ sudo mv /tmp/metrics.markdown.png /metrics_renders/
- name: Publish examples - name: Publish examples
if: ${{ success() || failure() }} if: ${{ success() || failure() }}

View File

@@ -1202,7 +1202,7 @@ jobs:
- name: Screenshot markdown example - name: Screenshot markdown example
if: ${{ success() || failure() }} if: ${{ success() || failure() }}
run: | run: |
docker run --entrypoint="" --volume=/tmp:/tmp ghcr.io/lowlighter/metrics:master node /metrics/.github/scripts/markdown_example.mjs docker run --rm --entrypoint="" --volume=/tmp:/tmp ghcr.io/lowlighter/metrics:master node /metrics/.github/scripts/markdown_example.mjs
sudo mv /tmp/metrics.markdown.png /metrics_renders/ sudo mv /tmp/metrics.markdown.png /metrics_renders/
- name: Publish examples - name: Publish examples
if: ${{ success() || failure() }} if: ${{ success() || failure() }}

View File

@@ -46,7 +46,7 @@ jobs:
- name: Build lowlighter/metrics:${{ github.head_ref || 'master' }} - name: Build lowlighter/metrics:${{ github.head_ref || 'master' }}
run: docker build -t lowlighter/metrics:$(echo ${{ github.head_ref || 'master' }} | sed 's/\//-/g') . run: docker build -t lowlighter/metrics:$(echo ${{ github.head_ref || 'master' }} | sed 's/\//-/g') .
- name: Run tests - name: Run tests
run: docker run --entrypoint="" lowlighter/metrics:$(echo ${{ github.head_ref || 'master' }} | sed 's/\//-/g') npm run test-metrics run: docker run --rm --entrypoint="" lowlighter/metrics:$(echo ${{ github.head_ref || 'master' }} | sed 's/\//-/g') npm run test-metrics
# Run CodeQL on branch # Run CodeQL on branch
analyze: analyze:

2
action.yml generated
View File

@@ -1244,7 +1244,7 @@ runs:
echo "::endgroup::" echo "::endgroup::"
# Run docker image with current environment # Run docker image with current environment
docker run --init --volume $GITHUB_EVENT_PATH:$GITHUB_EVENT_PATH --volume $METRICS_RENDERS:/renders --env-file .env $METRICS_IMAGE docker run --init --rm --volume $GITHUB_EVENT_PATH:$GITHUB_EVENT_PATH --volume $METRICS_RENDERS:/renders --env-file .env $METRICS_IMAGE
rm .env rm .env
shell: bash shell: bash
env: env:

View File

@@ -99,7 +99,7 @@ runs:
echo "::endgroup::" echo "::endgroup::"
# Run docker image with current environment # Run docker image with current environment
docker run --init --volume $GITHUB_EVENT_PATH:$GITHUB_EVENT_PATH --volume $METRICS_RENDERS:/renders --env-file .env $METRICS_IMAGE docker run --init --rm --volume $GITHUB_EVENT_PATH:$GITHUB_EVENT_PATH --volume $METRICS_RENDERS:/renders --env-file .env $METRICS_IMAGE
rm .env rm .env
shell: bash shell: bash
env: env: