Skip to content

armgit / xtool

Public Imported from GitHub
0

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

Add prebuilt Docker image (#233)

Kabir Oberai697adae78b76
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..df31b0f
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,8 @@
+*
+!/Package.swift
+!/Package.resolved
+!/Sources
+!/Tests
+!/Linux
+/Linux/packages
+/Linux/staging
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 8bc542e..89b1df7 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -81,3 +81,17 @@ jobs:
TAG="${{ github.ref_name }}"
gh release create "$TAG" --draft --title "v$TAG"
gh release upload "$TAG" output/**/*.{AppImage,AppImage.zsync,app.zip,app.dSYM.zip}
+ docker:
+ uses: docker/github-builder/.github/workflows/build.yml@v1
+ permissions:
+ contents: read # to fetch the repository content
+ id-token: write # for signing attestations and cache entries with GitHub OIDC
+ packages: write # to push built images to GitHub Container Registry
+ with:
+ output: image
+ push: true
+ platforms: linux/amd64,linux/arm64
+ meta-images: |
+ ghcr.io/xtool-org/xtool
+ meta-tags: |
+ type=semver,pattern={{version}}
diff --git a/Dockerfile b/Dockerfile
index af67fa3..6e9c71d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -79,11 +79,15 @@ RUN cd xadi \
&& cp -r bin/libxadi.so /prefix/usr/lib/libxadi.so
-FROM build-base
+FROM build-base AS build-xtool-base
COPY --from=build-limd /prefix/usr /usr
COPY --from=build-xadi /prefix/usr /usr
+WORKDIR /xtool
+
+FROM build-xtool-base AS dev
+
# Docker doesn't support FUSE
ENV APPIMAGE_EXTRACT_AND_RUN=1
@@ -92,6 +96,20 @@ ENV APPIMAGE_EXTRACT_AND_RUN=1
# socat -dd TCP-LISTEN:27015,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/run/usbmuxd
ENV USBMUXD_SOCKET_ADDRESS=host.docker.internal:27015
-WORKDIR /xtool
-
CMD [ "/bin/bash" ]
+
+FROM build-xtool-base AS build-xtool
+
+ADD Package.swift Package.resolved /xtool/
+RUN swift package resolve
+
+ADD . /xtool
+RUN ./Linux/build.sh
+
+FROM swift:6.3 AS xtool
+
+COPY --from=build-xtool /xtool/Linux/packages/xtool-*.AppImage /xtool/xtool.AppImage
+RUN (cd /xtool && ./xtool.AppImage --appimage-extract) \
+ && mv /xtool/squashfs-root /usr/local/xtool \
+ && rm -rf /xtool \
+ && ln -s /usr/local/xtool/AppRun /usr/local/bin/xtool
diff --git a/Makefile b/Makefile
index cdad256..342f0a4 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,10 @@ linux-clean:
linux-dist:
docker compose run --build --rm xtool Linux/build.sh
+.PHONY: docker
+docker:
+ docker build . -t ghcr.io/xtool-org/xtool:latest
+
.PHONY: mac
# dev build for macOS
mac: project
diff --git a/docker-compose.yml b/docker-compose.yml
index 8a9dfa8..c1d48c0 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -2,8 +2,10 @@ services:
xtool:
build:
context: .
+ target: dev
volumes:
- .:/xtool
+ - .build/linux:/xtool/.build
container_name: xtool
stdin_open: true
tty: true
@@ -13,6 +15,4 @@ services:
- seccomp:unconfined
extra_hosts:
# host.docker.internal doesn't exist by default on Linux hosts
- # TODO: Does this conflict with the default host on macOS?
- # we could rename this
- "host.docker.internal:host-gateway"