Skip to content

Commit fe664e2

Browse files
authored
fix: architecture conflict (#152)
* fix: architecture conflict fix: download * fix: add paths fix * fix: add suffix * chore: add pull request * fix run sh * fix: wrong arg * fix equal check
1 parent 5983eaa commit fe664e2

File tree

4 files changed

+29
-17
lines changed

4 files changed

+29
-17
lines changed

.github/actions/download/action.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ runs:
4444
- name: download oocana
4545
run: |
4646
if [ "${{ inputs.architecture }}" = "amd64" ]; then
47-
gh release download ${{ inputs.oocana }} --repo oomol/oocana-rust --pattern "oocana-cli-x86_64-unknown-linux-gnu.tar.gz" -O oocana-cli.tar.gz
48-
tar -xf oocana-cli.tar.gz -C /tmp
47+
gh release download ${{ inputs.oocana }} --repo oomol/oocana-rust --pattern "oocana-cli-x86_64-unknown-linux-gnu.tar.gz" --clobber -O oocana-cli-${{inputs.architecture}}.tar.gz
48+
tar -xf oocana-cli-${{inputs.architecture}}.tar.gz -C /tmp
4949
mv /tmp/oocana-cli-x86_64-unknown-linux-gnu $(pwd)/${{inputs.architecture}}/oocana
5050
elif [ "${{ inputs.architecture }}" = "arm64" ]; then
51-
gh release download ${{ inputs.oocana }} --repo oomol/oocana-rust --pattern "oocana-cli-aarch64-unknown-linux-gnu.tar.gz" -O oocana-cli.tar.gz
52-
tar -xf oocana-cli.tar.gz -C /tmp
51+
gh release download ${{ inputs.oocana }} --repo oomol/oocana-rust --pattern "oocana-cli-aarch64-unknown-linux-gnu.tar.gz" --clobber -O oocana-cli-${{inputs.architecture}}.tar.gz
52+
tar -xf oocana-cli-${{inputs.architecture}}.tar.gz -C /tmp
5353
mv /tmp/oocana-cli-aarch64-unknown-linux-gnu $(pwd)/${{inputs.architecture}}/oocana
5454
fi
5555
shell: bash
@@ -59,9 +59,9 @@ runs:
5959
- name: download ovmlayer
6060
run: |
6161
if [ "${{ inputs.architecture }}" = "amd64" ]; then
62-
gh release download ${{ inputs.ovmlayer }} --repo oomol/ovmlayer-rootfs --pattern "ovmlayer_amd64.tar.zst" -O ovmlayer.tar.zst
62+
gh release download ${{ inputs.ovmlayer }} --repo oomol/ovmlayer-rootfs --pattern "ovmlayer_amd64.tar.zst" --clobber -O ovmlayer-${{inputs.architecture}}.tar.zst
6363
elif [ "${{ inputs.architecture }}" = "arm64" ]; then
64-
gh release download ${{ inputs.ovmlayer }} --repo oomol/ovmlayer-rootfs --pattern "ovmlayer_arm64.tar.zst" -O ovmlayer.tar.zst
64+
gh release download ${{ inputs.ovmlayer }} --repo oomol/ovmlayer-rootfs --pattern "ovmlayer_arm64.tar.zst" --clobber -O ovmlayer-${{inputs.architecture}}.tar.zst
6565
fi
6666
shell: bash
6767
env:
@@ -70,8 +70,8 @@ runs:
7070
- name: extract ovmlayer
7171
run: |
7272
mkdir -p /tmp/ovmlayer
73-
zstd -d ovmlayer.tar.zst -o /tmp/ovmlayer.tar
74-
tar -xf /tmp/ovmlayer.tar -C $(pwd)/${{inputs.architecture}}
73+
zstd -d ovmlayer-${{inputs.architecture}}.tar.zst -o /tmp/ovmlayer-${{inputs.architecture}}.tar
74+
tar -xf /tmp/ovmlayer-${{inputs.architecture}}.tar -C $(pwd)/${{inputs.architecture}}
7575
shell: bash
7676

7777
- name: download rootfs

.github/workflows/build-studio-image.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
name: build studio image
22
on:
3+
pull_request:
4+
paths:
5+
- "studio.dockerfile"
6+
- "package.json"
7+
- "package-lock.json"
8+
- ".github/actions/ovmlayer/action.yml"
9+
- ".github/workflows/build-studio-image.yaml"
310
push:
411
paths:
512
- "studio.dockerfile"
613
- "package.json"
714
- "package-lock.json"
15+
- ".github/actions/ovmlayer/action.yml"
816
- ".github/workflows/build-studio-image.yaml"
917
workflow_dispatch:
1018

scripts/bin.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
#!/usr/bin/env bash
12
set -x
2-
echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" > /1.log
3-
if TARGETPLATFORM == "linux/amd64"; then
4-
echo "Downloading amd64 oocana and ovmlayer" >> /1.log
3+
echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" > /tmp/1.log
4+
if [ "$TARGETPLATFORM" == "linux/amd64" ]; then
5+
echo "Downloading amd64 oocana and ovmlayer" >> /tmp/1.log
56
cp -r ./amd64/oocana /app/
67
cp -r ./amd64/ovmlayer /app/
78
cp ./amd64/rootfs.tar /root/rootfs.tar
8-
elif TARGETPLATFORM == "linux/arm64"; then
9-
echo "Downloading arm64 oocana and ovmlayer" >> /1.log
9+
elif [ "$TARGETPLATFORM" == "linux/arm64" ]; then
10+
echo "Downloading arm64 oocana and ovmlayer" >> /tmp/1.log
1011
cp -r ./arm64/oocana /app/
1112
cp -r ./arm64/ovmlayer /app/
1213
cp ./arm64/rootfs.tar /root/rootfs.tar
1314
else
14-
echo "Unsupported platform: $TARGETPLATFORM" >> /1.log
15-
exit 1
15+
echo "Unsupported platform: $TARGETPLATFORM" >> /tmp/1.log
16+
exit 23
1617
fi

studio.dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# https://github.com/docker/docs/issues/20935
33
FROM ghcr.io/oomol/server-base:v0.4.1
44

5+
ARG TARGETPLATFORM
6+
ARG BUILDPLATFORM
7+
58
# npm config get cache
69
ENV NPM_CACHE=$HOME/.npm
710
WORKDIR /app
@@ -22,7 +25,7 @@ RUN mkdir -p /opt/ovmlayer
2225
COPY ./entrypoint.sh /root/entrypoint.sh
2326
COPY ./amd64 ./amd64
2427
COPY ./arm64 ./arm64
25-
COPY ./scripts/bin.sh /bin.sh
26-
RUN ./bin.sh
28+
COPY ./scripts/bin.sh /root/bin.sh
29+
RUN TARGETPLATFORM=$TARGETPLATFORM BUILDPLATFORM=$BUILDPLATFORM /root/bin.sh
2730
RUN rm -rf ./amd64 ./arm64
2831
ENTRYPOINT [ "bash", "-x", "/root/entrypoint.sh" ]

0 commit comments

Comments
 (0)