Skip to content

Instantly share code, notes, and snippets.

@leogdion
Created June 16, 2025 21:03
Show Gist options
  • Save leogdion/1acd96c2b628c11254733fbf07e302d7 to your computer and use it in GitHub Desktop.
Save leogdion/1acd96c2b628c11254733fbf07e302d7 to your computer and use it in GitHub Desktop.
Dockerfile for xtool
# Use Ubuntu 24.04 as the base image
FROM ubuntu:24.04
# Set environment variables to avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
build-essential \
ca-certificates \
wget \
fuse \
binutils \
libc6-dev \
libcurl4-openssl-dev \
libedit2 \
libgcc-9-dev \
libpython3.8 \
libsqlite3-0 \
libstdc++-9-dev \
libxml2-dev \
libz3-dev \
pkg-config \
tzdata \
zlib1g-dev \
libncurses6 \
&& rm -rf /var/lib/apt/lists/*
# Install Swift using swiftly
RUN curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz && \
tar zxf swiftly-$(uname -m).tar.gz && \
./swiftly init --quiet-shell-followup && \
bash -c '. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" && swiftly install latest' && \
rm swiftly-$(uname -m).tar.gz
# Add swiftly environment to PATH
ENV SWIFTLY_HOME_DIR="/root/.local/share/swiftly"
# Verify Swift installation
RUN bash -c '. "${SWIFTLY_HOME_DIR}/env.sh" && swift --version'
# Download and install xtool AppImage
RUN curl -fL \
"https://github.com/xtool-org/xtool/releases/latest/download/xtool-$(uname -m).AppImage" \
-o /usr/local/bin/xtool && \
chmod +x /usr/local/bin/xtool
# Set up working directory
WORKDIR /workspace
# Note: xtool verification will be done at runtime when FUSE is available
# You can verify installation after running the container with: xtool --help
# Note: Mount your current directory (containing Xcode.xip) when running:
# docker run --privileged -v $(pwd):/workspace -it xtool-container
#
# Then inside the container, source swiftly environment and run:
# source ~/.local/share/swiftly/env.sh
# xtool setup
#
# The setup command will look for Xcode.xip in the current directory (/workspace)
# Set up shell to automatically source swiftly environment
RUN echo 'source "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh"' >> ~/.bashrc
# Default command
CMD ["bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment