From e4bafc776e91c11e449598acb33b6e509314aed5 Mon Sep 17 00:00:00 2001 From: Sebastiano Mariani Date: Tue, 15 Nov 2022 13:49:39 -0800 Subject: [PATCH] Add Github actions to build and push images to Docker Hub (#1) Signed-off-by: Sebastiano Mariani --- .github/workflows/release-latest.yml | 23 +++++++++++++++++++++++ .github/workflows/test-build-latest.yml | 18 ++++++++++++++++++ build-docker-compose.yml | 4 ++-- docker-compose.yml | 4 ++-- 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release-latest.yml create mode 100644 .github/workflows/test-build-latest.yml diff --git a/.github/workflows/release-latest.yml b/.github/workflows/release-latest.yml new file mode 100644 index 0000000..4b31144 --- /dev/null +++ b/.github/workflows/release-latest.yml @@ -0,0 +1,23 @@ +name: Build the Docker images and push them to Docker Hub + +on: + # Only trigger the workflow when there is a new commit to the master branch + push: + branches: [ "master" ] + +jobs: + deploy: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + steps: + # checkout the repository in the ubuntu-latest environment + - uses: actions/checkout@v3 + + - name: Build the Docker images + run: docker compose --file build-docker-compose.yml --env-file template.env build + + - name: Push the Docker images to Docker Hub + run: | + echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin + docker compose -f build-docker-compose.yml push diff --git a/.github/workflows/test-build-latest.yml b/.github/workflows/test-build-latest.yml new file mode 100644 index 0000000..465fccb --- /dev/null +++ b/.github/workflows/test-build-latest.yml @@ -0,0 +1,18 @@ +name: Build the Docker images + +on: + # Only trigger the workflow when there is a PR on the master branch + pull_request: + branches: [ "master" ] + +jobs: + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + steps: + # checkout the repository in the ubuntu-latest environment + - uses: actions/checkout@v3 + + - name: Build the Docker images + run: docker compose --file build-docker-compose.yml --env-file template.env build diff --git a/build-docker-compose.yml b/build-docker-compose.yml index b44ad2c..6616000 100644 --- a/build-docker-compose.yml +++ b/build-docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: misp: - image: coolacid/misp-docker:core-latest + image: ostefano/misp-docker:core-latest build: context: server/. args: @@ -10,7 +10,7 @@ services: - PHP_VER=${PHP_VER} misp-modules: - image: coolacid/misp-docker:modules-latest + image: ostefano/misp-docker:modules-latest build: context: modules/. args: diff --git a/docker-compose.yml b/docker-compose.yml index c6f1d6c..3fbdacb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: - SYS_NICE # CAP_SYS_NICE Prevent runaway mysql log misp: - image: coolacid/misp-docker:core-latest + image: ostefano/misp-docker:core-latest depends_on: - redis - db @@ -86,7 +86,7 @@ services: - "NSX_ANALYSIS_KEY=${NSX_ANALYSIS_KEY}" - "VIRUSTOTAL_KEY=${VIRUSTOTAL_KEY}" misp-modules: - image: coolacid/misp-docker:modules-latest + image: ostefano/misp-docker:modules-latest environment: - "REDIS_BACKEND=redis" depends_on: