From d4e19d8a7f59a6c34347bc25bffb7c0e63411927 Mon Sep 17 00:00:00 2001 From: leukosaima <187358+leukosaima@users.noreply.github.com> Date: Wed, 10 Jan 2024 21:10:16 -0500 Subject: [PATCH 1/7] Create Dockerfile --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..3aec8166e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:3.19 + +COPY . /repocontents/ + +ENTRYPOINT ["/bin/sh", "-c", "rm -rf /mnt/netrunner-cards-json/* && cp -r /repocontents/* /mnt/netrunner-cards-json/ && exit"] From 67bf260990dd6c6944952c22bf00203bb286861a Mon Sep 17 00:00:00 2001 From: leukosaima <187358+leukosaima@users.noreply.github.com> Date: Wed, 10 Jan 2024 22:04:39 -0500 Subject: [PATCH 2/7] Create docker-cicd --- .github/workflows/docker-cicd | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/docker-cicd diff --git a/.github/workflows/docker-cicd b/.github/workflows/docker-cicd new file mode 100644 index 000000000..0902ad2c9 --- /dev/null +++ b/.github/workflows/docker-cicd @@ -0,0 +1,20 @@ +name: docker-cicd + +on: + push: + branches: + - 'main' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + tags: registry.digitalocean.com/nsgcr/netrunner-cards-json:latest From 1393175bff1c0c4bd01c7f4cc0339934544fd0d7 Mon Sep 17 00:00:00 2001 From: leukosaima <187358+leukosaima@users.noreply.github.com> Date: Wed, 10 Jan 2024 22:14:04 -0500 Subject: [PATCH 3/7] Update and rename docker-cicd to docker-cicd.yml --- .github/workflows/docker-cicd | 20 ----------------- .github/workflows/docker-cicd.yml | 36 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 20 deletions(-) delete mode 100644 .github/workflows/docker-cicd create mode 100644 .github/workflows/docker-cicd.yml diff --git a/.github/workflows/docker-cicd b/.github/workflows/docker-cicd deleted file mode 100644 index 0902ad2c9..000000000 --- a/.github/workflows/docker-cicd +++ /dev/null @@ -1,20 +0,0 @@ -name: docker-cicd - -on: - push: - branches: - - 'main' - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push - uses: docker/build-push-action@v5 - with: - push: true - tags: registry.digitalocean.com/nsgcr/netrunner-cards-json:latest diff --git a/.github/workflows/docker-cicd.yml b/.github/workflows/docker-cicd.yml new file mode 100644 index 000000000..874bc7a0b --- /dev/null +++ b/.github/workflows/docker-cicd.yml @@ -0,0 +1,36 @@ +name: docker-cicd + +on: + push: + branches: + - 'main' + +jobs: + build_and_push: + runs-on: ubuntu-latest + steps: + + - name: Checkout the repo + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build image + run: docker build -t nsgcr/netrunner-cards-json . + + - name: Install doctl + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} + + - name: Log in to DO Container Registry + run: doctl registry login --expiry-seconds 600 + + - name: Tag image + run: + docker tag nsgcr/netrunner-cards-json \ + registry.digitalocean.com/nsgcr/netrunner-cards-json:${{ github.run_id }} + + - name: Push image to DO Container Registry + run: docker push registry.digitalocean.com/nsgcr/netrunner-cards-json:${{ github.run_id }} From 660502ed7fe71e0c67cc3673324721db41bc633e Mon Sep 17 00:00:00 2001 From: leukosaima <187358+leukosaima@users.noreply.github.com> Date: Wed, 10 Jan 2024 22:17:03 -0500 Subject: [PATCH 4/7] Update ci.yml not to run on push to main --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 250110117..60657169c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,9 +3,6 @@ name: CI # This action works with pull requests and pushes on: pull_request: - push: - branches: - - main env: # We do not need Husky hooks installed for this workflow. From 2eabd00d52cd1807dcb67fda9d5bd045bd67df76 Mon Sep 17 00:00:00 2001 From: leukosaima <187358+leukosaima@users.noreply.github.com> Date: Wed, 10 Jan 2024 22:19:23 -0500 Subject: [PATCH 5/7] Update docker-cicd.yml --- .github/workflows/docker-cicd.yml | 33 ++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-cicd.yml b/.github/workflows/docker-cicd.yml index 874bc7a0b..5d80468d0 100644 --- a/.github/workflows/docker-cicd.yml +++ b/.github/workflows/docker-cicd.yml @@ -3,10 +3,41 @@ name: docker-cicd on: push: branches: - - 'main' + - main + +env: + # We do not need Husky hooks installed for this workflow. + HUSKY: 0 jobs: + format_and_lint_and_test: + name: Format, Lint, Test + runs-on: ubuntu-latest + steps: + + - name: Checkout the repo + uses: actions/checkout@v2 + + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: "18.x" + + - name: Install dependencies + run: npm install + + - name: Format Check + run: npm run format-check + + - name: Lint + run: npm run lint + + - name: Test + run: npm run test + build_and_push: + name: Docker build and push + needs: format_and_lint_and_test runs-on: ubuntu-latest steps: From bb79184f8ede146eff16792eeebe79c330bd9494 Mon Sep 17 00:00:00 2001 From: Paul Filion Date: Sun, 14 Jan 2024 09:38:37 -0500 Subject: [PATCH 6/7] code review --- .github/workflows/ci.yml | 2 ++ .github/workflows/docker-cicd.yml | 12 ++++++++++-- Dockerfile | 6 ++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60657169c..5d91a4616 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,8 @@ name: CI # This action works with pull requests and pushes on: pull_request: + branches: + - main env: # We do not need Husky hooks installed for this workflow. diff --git a/.github/workflows/docker-cicd.yml b/.github/workflows/docker-cicd.yml index 5d80468d0..123c16939 100644 --- a/.github/workflows/docker-cicd.yml +++ b/.github/workflows/docker-cicd.yml @@ -58,10 +58,18 @@ jobs: - name: Log in to DO Container Registry run: doctl registry login --expiry-seconds 600 - - name: Tag image + - name: Tag image with run id run: docker tag nsgcr/netrunner-cards-json \ registry.digitalocean.com/nsgcr/netrunner-cards-json:${{ github.run_id }} + + - name: Tag image with latest + run: + docker tag nsgcr/netrunner-cards-json \ + registry.digitalocean.com/nsgcr/netrunner-cards-json:latest - - name: Push image to DO Container Registry + - name: Push run id tag to DO Container Registry run: docker push registry.digitalocean.com/nsgcr/netrunner-cards-json:${{ github.run_id }} + + - name: Push latest tag to DO Container Registry + run: docker push registry.digitalocean.com/nsgcr/netrunner-cards-json:latest diff --git a/Dockerfile b/Dockerfile index 3aec8166e..25fcc3f06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM alpine:3.19 -COPY . /repocontents/ +COPY ./v2/ /netrunner-cards-json/v2/ +COPY ./translations/ /netrunner-cards-json/translations/ +COPY ./cycles.json ./factions.json ./mwl.json ./packs.json ./prebuilts.json ./rotations.json ./sides.json ./types.json /netrunner-cards-json/ -ENTRYPOINT ["/bin/sh", "-c", "rm -rf /mnt/netrunner-cards-json/* && cp -r /repocontents/* /mnt/netrunner-cards-json/ && exit"] +ENTRYPOINT ["/bin/sh", "-c", "rm -rf /mnt/netrunner-cards-json/* && cp -r /netrunner-cards-json/* /mnt/netrunner-cards-json/ && exit"] From 7d925f8b98edb914634d8c0b7cc9d07a74edbc72 Mon Sep 17 00:00:00 2001 From: Paul Filion Date: Sun, 14 Jan 2024 09:45:30 -0500 Subject: [PATCH 7/7] added pack folder to dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 25fcc3f06..d1af6fe12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM alpine:3.19 COPY ./v2/ /netrunner-cards-json/v2/ COPY ./translations/ /netrunner-cards-json/translations/ +COPY ./pack/ /netrunner-cards-json/pack/ COPY ./cycles.json ./factions.json ./mwl.json ./packs.json ./prebuilts.json ./rotations.json ./sides.json ./types.json /netrunner-cards-json/ ENTRYPOINT ["/bin/sh", "-c", "rm -rf /mnt/netrunner-cards-json/* && cp -r /netrunner-cards-json/* /mnt/netrunner-cards-json/ && exit"]