Setting Up the LXC Container

2 minute read

Keeping the F-Droid build environment separate in an Alpine container with Proxmox.

I’m using LXC containers on Proxmox. If you have a different method of working with containers I’m pretty sure you’ll be able to use the info here and repurpose it to your preferences.

Create an Alpine container

I won’t go into the details of how to do this as it’s specific to Proxmox and no different to setting up any other LXC container in Proxmox.

I’m using Alpine Linux as the container distro as it’s very lightweight and the F-Droid tools don’t need anything fancy.

In terms of resources, it doesn’t need much, the following has been more than enough for me so far:

  • 512MB RAM
  • 512MB swap
  • 8GB disk

How naive of me, Gradle is much more greedy than I originally thought and I was getting build errors due to low resources. So I set the container up with:

  • 6GB RAM
  • 1GB swap
  • 16GB disk

Set up the container for F-Droid builds

While logged into my Alpine container, first I set up some basics:

# Ensure everything is up to date
apk update
apk upgrade

# Install and configure git
apk add git vim
git config --global user.name "<YOUR_NAME>"
git config --global user.email "<YOUR_EMAIL>"
ssh-keygen
cat .ssh/id_rsa.pub 
# ... then copy key to gitlab SSH keys

F-Droid build instructions depend on docker, so:

apk add docker

# Start docker on boot
rc-update add docker boot

# Start docker now (or reboot so the above command can take effect)
service docker start

Now get the F-Droid stuff installed:

git clone --depth=1 git@gitlab.com:<YOUR_ACCOUNT>/fdroiddata.git ~/fdroiddata
cd ~/fdroiddata
git checkout -b com.example
cp templates/build-gradle.yml metadata/com.example.yml



# If (like me) you already created a fork before it's a little different 
# and you have to do this instead of the above

# git clone --depth=1 git@gitlab.com:<YOUR_ACCOUNT>/fdroiddata.git ~/fdroiddata
# cd fdroiddata/

# Shallow cloning makes other branches inaccessible, fix that
# git remote set-branches origin '*'
# git fetch -v --depth=1

# And now the branch can be checked out
# git checkout com.example

The container is set up now, later on on we’ll get around to how to actually use it…