Skip to content

Commit

Permalink
Added support for arm64 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Nguyen Thai authored and hoangdat committed Oct 11, 2023
1 parent 66a5894 commit e95c3c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
environment: dev

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand Down Expand Up @@ -54,6 +57,7 @@ jobs:
uses: docker/build-push-action@v4
with:
push: true
platforms: "linux/amd64,linux/arm64"
cache-from: |
type=gha
cache-to: |
Expand All @@ -70,6 +74,9 @@ jobs:
environment: prod

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand Down Expand Up @@ -105,6 +112,7 @@ jobs:
uses: docker/build-push-action@v4
with:
push: true
platforms: "linux/amd64,linux/arm64"
cache-from: |
type=gha
cache-to: |
Expand Down
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@ ARG FLUTTER_VERSION=3.10.6
ARG OLM_VERSION=3.2.15

# Building libolm
FROM nixos/nix AS olm-builder
# libolm only has amd64
FROM --platform=linux/amd64 nixos/nix AS olm-builder
ARG OLM_VERSION
RUN nix build -v --extra-experimental-features flakes --extra-experimental-features nix-command gitlab:matrix-org/olm/${OLM_VERSION}?host=gitlab.matrix.org\#javascript

# Building Twake web files
FROM ghcr.io/cirruslabs/flutter:${FLUTTER_VERSION} as web-builder
# Building Twake for the web
FROM --platform=linux/amd64 ghcr.io/cirruslabs/flutter:${FLUTTER_VERSION} AS web-builder
COPY . /app
WORKDIR /app
RUN apt update && \
apt install openssh-client -y && \
RUN DEBIAN_FRONTEND=noninteractive apt update && \
apt install -y openssh-client && \
rm -rf assets/js/* && \
mkdir ~/.ssh && \
ssh-keyscan github.com >> ~/.ssh/known_hosts
COPY --from=olm-builder /result/javascript assets/js/package
RUN --mount=type=ssh,required=true ./scripts/build-web.sh

# Final image
FROM nginx:alpine
FROM nginx:alpine AS final-image
RUN rm -rf /usr/share/nginx/html
COPY --from=web-builder /app/build/web /usr/share/nginx/html/web/

Expand Down

0 comments on commit e95c3c4

Please sign in to comment.