Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Support AMD64 and ARM64 images #5

Merged
merged 4 commits into from
Jan 28, 2024
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
20 changes: 16 additions & 4 deletions .github/workflows/docker-builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
platform: [amd64, arm64]
steps:
- name: Code Checkout
uses: actions/checkout@v4
Expand All @@ -31,17 +34,25 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PAT }}

- name: ARM64 QEMU Setup
if: matrix.platform == 'arm64'
uses: docker/setup-qemu-action@v3

- name: Docker Buildx Setup
uses: docker/setup-buildx-action@v3

- name: Architecture specific Environment Variable Setup
run: echo "BWS_DL_ARCH=$(if [ '${{ matrix.platform }}' == 'amd64' ]; then echo 'x86_64'; else echo 'aarch64'; fi)" >> $GITHUB_ENV

- name: Manual Build/Push
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: docker/build-push-action@v5
with:
push: true
platforms: |
linux/amd64
platforms: linux/amd64, linux/arm64
context: src
build-args: |
BWS_DL_ARCH=${{ env.BWS_DL_ARCH }}
tags: |
bojanraic/bwsm-eso:${{ inputs.image_tag }}

Expand All @@ -50,9 +61,10 @@ jobs:
uses: docker/build-push-action@v5
with:
push: true
platforms: |
linux/amd64
platforms: linux/amd64, linux/arm64
context: src
build-args: |
BWS_DL_ARCH=${{ env.BWS_DL_ARCH }}
tags: |
bojanraic/bwsm-eso:${{ github.ref_name }}
bojanraic/bwsm-eso:latest
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/docker-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
docker-image-build:
environment: 'dockerhub'
runs-on: ubuntu-latest
strategy:
matrix:
platform: [amd64, arm64]
steps:
- name: Code Checkout
uses: actions/checkout@v4
Expand All @@ -19,16 +22,24 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PAT }}

- name: ARM64 QEMU Setup
if: matrix.platform == 'arm64'
uses: docker/setup-qemu-action@v3

- name: Docker Buildx Setup
uses: docker/setup-buildx-action@v3

- name: Architecture specific Environment Variable Setup
run: echo "BWS_DL_ARCH=$(if [ '${{ matrix.platform }}' == 'amd64' ]; then echo 'x86_64'; else echo 'aarch64'; fi)" >> $GITHUB_ENV

- name: Nighhly Build/Push From Default Branch
uses: docker/build-push-action@v5
with:
push: true
platforms: |
linux/amd64
platforms: linux/amd64, linux/arm64
context: src
build-args: |
BWS_DL_ARCH=${{ env.BWS_DL_ARCH }}
tags: |
bojanraic/bwsm-eso:nightly

Expand All @@ -46,9 +57,10 @@ jobs:
uses: docker/build-push-action@v5
with:
push: true
platforms: |
linux/amd64
platforms: linux/amd64, linux/arm64
context: src
build-args: |
BWS_DL_ARCH=${{ env.BWS_DL_ARCH }}
tags: |
bojanraic/bwsm-eso:${{ steps.most-recent-tag.outputs.tag }}
bojanraic/bwsm-eso:latest
7 changes: 4 additions & 3 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
ARG BWS_VERSION=0.4.0 \
BWS_DL_ARCH=x86_64 \
NODE_ENV=production \
PORT=8080 \
WORKDIR=/app

FROM cgr.dev/chainguard/node-lts as base
ARG WORKDIR
ARG WORKDIR BWS_DL_ARCH
WORKDIR $WORKDIR
COPY . .
ENV NODE_ENV=$NODE_ENV \
Expand All @@ -17,10 +18,10 @@ RUN npm ci && \

FROM busybox:stable-uclibc as bws

ARG BWS_VERSION WORKDIR
ARG BWS_VERSION WORKDIR BWS_DL_ARCH
WORKDIR $WORKDIR

ADD https://github.com/bitwarden/sdk/releases/download/bws-v${BWS_VERSION}/bws-x86_64-unknown-linux-gnu-${BWS_VERSION}.zip /tmp/bws.zip
ADD https://github.com/bitwarden/sdk/releases/download/bws-v${BWS_VERSION}/bws-${BWS_DL_ARCH}-unknown-linux-gnu-${BWS_VERSION}.zip /tmp/bws.zip
RUN unzip /tmp/bws.zip -d . && rm -rf /tmp/* && chmod +x ./bws

FROM cgr.dev/chainguard/node-lts as runner
Expand Down
Loading