Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Docker Build & Push Method #1704

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions .github/workflows/build-and-publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@ name: Build & Publish Image
on:
# Scan on workflow call
workflow_call:
secrets:
GHCR_TOKEN:
required: true
# Scan on-demand through GitHub Actions interface:
workflow_dispatch: {}

jobs:
build_and_push:
runs-on: ubuntu-latest
permissions:
packages: write
name: Build and publish
steps:
- uses: actions/checkout@v3

# https://github.com/marketplace/actions/push-to-ghcr
- name: Build and publish a Docker image for asvs/documentbuilder #${{ github.repository }}
uses: macbre/push-to-ghcr@master
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
image_name: asvs/documentbuilder #${{ github.repository }} # it will be lowercased internally
github_token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: docker/Dockerfile
context: docker
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: 'Build and publish Docker image'
run: |
docker build ./docker/ --tag ghcr.io/owasp/asvs/documentbuilder:latest
docker push ghcr.io/owasp/asvs/documentbuilder:latest

4 changes: 2 additions & 2 deletions COMPILING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
To build the docker image manually, use this command:

```
docker image build --tag ghcr.io/asvs/documentbuilder -f docker/Dockerfile .
docker image build --tag ghcr.io/owasp/asvs/documentbuilder -f docker/Dockerfile .
```

To run the document builder manually, use the following. The Volume you are mounting (`-v `) needs to be shared in the docker settings console for this to work:

```
docker run --rm -v "/Path/to/the/repo/4.0:/data" ghcr.io/asvs/documentbuilder
docker run --rm -v "/Path/to/the/repo/4.0:/data" ghcr.io/owasp/asvs/documentbuilder
```

## Future Changes
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ all: 5.0 4.0
4.0-LANGS := $(shell cd 4.0 && git status --porcelain | sed 's/[ A-Z?]\+ \"\?4.0\///g' | sed 's/\/.*//g' | sed -n '/^\(ar\|de\|en\|es\|fr\|pt\|ru\|zh-cn\)/p' | tr '\n' ' ')

5.0:
docker run --rm --user $(id -u):$(id -g) -v "`pwd`/5.0:/data" -v "`pwd`/docker:/scripts" -e "TARGET=5.0" -e "FORMATS=$(FORMATS)" ghcr.io/asvs/documentbuilder
docker run --rm --user $(id -u):$(id -g) -v "`pwd`/5.0:/data" -v "`pwd`/docker:/scripts" -e "TARGET=5.0" -e "FORMATS=$(FORMATS)" ghcr.io/owasp/asvs/documentbuilder
5.0-clean:
docker run --rm --user $(id -u):$(id -g) -v "`pwd`/5.0:/data" -v "`pwd`/docker:/scripts" -e "TARGET=clean" -e "FORMATS=$(FORMATS)" ghcr.io/asvs/documentbuilder
docker run --rm --user $(id -u):$(id -g) -v "`pwd`/5.0:/data" -v "`pwd`/docker:/scripts" -e "TARGET=clean" -e "FORMATS=$(FORMATS)" ghcr.io/owasp/asvs/documentbuilder

4.0:
docker run --rm --user $(id -u):$(id -g) -v "`pwd`/4.0:/data" -v "`pwd`/docker:/scripts" -e "TARGET=4.0" -e "FORMATS=$(FORMATS)" -e "LANGS=$(4.0-LANGS)" ghcr.io/asvs/documentbuilder
docker run --rm --user $(id -u):$(id -g) -v "`pwd`/4.0:/data" -v "`pwd`/docker:/scripts" -e "TARGET=4.0" -e "FORMATS=$(FORMATS)" -e "LANGS=$(4.0-LANGS)" ghcr.io/owasp/asvs/documentbuilder
4.0-clean:
docker run --rm --user $(id -u):$(id -g) -v "`pwd`/4.0:/data" -v "`pwd`/docker:/scripts" -e "TARGET=clean" -e "FORMATS=$(FORMATS)" ghcr.io/asvs/documentbuilder
docker run --rm --user $(id -u):$(id -g) -v "`pwd`/4.0:/data" -v "`pwd`/docker:/scripts" -e "TARGET=clean" -e "FORMATS=$(FORMATS)" ghcr.io/owasp/asvs/documentbuilder

.PHONY: 5.0 5.0-clean 4.0 4.0-clean docker
docker:
docker build --build-arg CERT_FILE=docker/cert --tag ghcr.io/asvs/documentbuilder:latest --network host docker
docker build --build-arg CERT_FILE=docker/cert --tag ghcr.io/owasp/asvs/documentbuilder:latest --network host docker