diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..68751f8 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +Dockerfile.android +app.apk +.direnv/ +.github/ +.secrets +app.tar.xz +flake.nix +flake.lock diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..578c702 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,33 @@ +name: Build Android Docker Image and Upload Artifacts + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Depot CLI + uses: depot/setup-action@v1 + + - run: depot build --project 0k8767spqx --load --tag build -f Dockerfile . + env: + DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }} + + - name: Create artifact directory + run: mkdir -p artifacts + + - name: Copy artifacts from container + run: docker create --name extract build && docker cp extract:/out . + + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: output + path: out/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eb822f7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +FROM golang:bookworm AS builder-android +WORKDIR /build + +RUN apt update +RUN apt-get install curl unzip -y + +RUN curl -LO https://dl.google.com/android/repository/android-ndk-r27b-linux.zip && unzip android-ndk-r27b-linux.zip +ENV ANDROID_NDK_HOME=/build/android-ndk-r27b/ + +RUN apt-get install golang gcc gcc-mingw-w64 -y +RUN go install fyne.io/fyne/v2/cmd/fyne@latest + +COPY go.mod go.sum main.go Icon.png . +COPY helper ./helper +COPY pages ./pages +COPY preferences ./preferences +COPY resources ./resources +COPY state ./state + +RUN fyne package --target android -appID io.bbfs.app -icon Icon.png --release + + + +FROM golang:alpine AS builder-linux +WORKDIR /build + +RUN apk add go gcc libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev linux-headers mesa-dev xz +RUN go install fyne.io/fyne/v2/cmd/fyne@latest + +COPY go.mod go.sum main.go Icon.png . +COPY helper ./helper +COPY pages ./pages +COPY preferences ./preferences +COPY resources ./resources +COPY state ./state + +RUN fyne package --target linux -appID io.bbfs.app -icon Icon.png --release && mv app.tar.xz app_linux.tar.xz + + +FROM scratch +WORKDIR /out +COPY --from=builder-android /build/app.apk . +COPY --from=builder-linux /build/app_linux.tar.xz . diff --git a/depot.json b/depot.json new file mode 100644 index 0000000..f99d9b3 --- /dev/null +++ b/depot.json @@ -0,0 +1 @@ +{"id":"0k8767spqx"}