mirror of
https://github.com/stucki/docker-lineageos
synced 2024-12-19 17:12:29 -05:00
refactor(run.sh): Combined run and build scripts
fix(Dockerfile): Removed unnecessary PPA fix(Dockerfile): Removed duplicate curl package chore(Readme.md): Update documentation
This commit is contained in:
parent
e3c581772b
commit
9fd7f89abd
@ -9,11 +9,8 @@ RUN sed -i 's/main$/main universe/' /etc/apt/sources.list
|
||||
RUN apt-get -qq update
|
||||
|
||||
RUN apt-get install -y software-properties-common bsdmainutils curl file screen
|
||||
RUN add-apt-repository ppa:nilarimogard/webupd8
|
||||
RUN apt-get -qq update
|
||||
|
||||
RUN apt-get install -y android-tools-adb android-tools-fastboot
|
||||
RUN apt-get install -y bison build-essential curl flex git-core gnupg gperf libesd0-dev libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-6-jdk openjdk-6-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev
|
||||
RUN apt-get install -y bison build-essential flex git-core gnupg gperf libesd0-dev libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-6-jdk openjdk-6-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev
|
||||
RUN apt-get install -y g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
|
||||
RUN apt-get install -y tig
|
||||
|
||||
|
10
README.md
10
README.md
@ -10,23 +10,17 @@ The main working directory is a shared folder on the host system, so the Docker
|
||||
|
||||
**NOTE:** Remember that CyanogenMod is a huge project. It will consume a large amount of disk space (~80 GB) and it can easily take hours to build.
|
||||
|
||||
### How to build
|
||||
### How to run/build
|
||||
|
||||
**NOTES:**
|
||||
* You will need to [install Docker][Docker_Installation] to proceed!
|
||||
* If an image does not exists, ```docker build``` is executed first
|
||||
* When running ```docker build```, the whole folder incl. the "android" working directory is transferred to the Docker daemon. The only way to work around this currently is to move the "android" folder away, then rebuild, and move it back into place again.
|
||||
For more information, see [dotcloud/docker#2224].
|
||||
|
||||
```
|
||||
git clone https://github.com/stucki/docker-cyanogenmod.git
|
||||
cd docker-cyanogenmod
|
||||
./build.sh
|
||||
```
|
||||
|
||||
### How to run
|
||||
|
||||
```
|
||||
cd docker-cyanogenmod
|
||||
./run.sh
|
||||
```
|
||||
|
||||
|
12
build.sh
12
build.sh
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
SOURCE=$(pwd)/android
|
||||
|
||||
# Create a shared folder which will be used as working directory.
|
||||
test -d $SOURCE || mkdir $SOURCE
|
||||
|
||||
docker build --no-cache --rm -t stucki/cyanogenmod .
|
||||
|
||||
exit $?
|
27
run.sh
27
run.sh
@ -3,13 +3,32 @@
|
||||
cd $(dirname $0)
|
||||
|
||||
SOURCE=$(pwd)/android
|
||||
CONTAINER_HOME=/home/cmbuild
|
||||
CONTAINER=cyanogenmod
|
||||
REPOSITORY=stucki/cyanogenmod
|
||||
|
||||
# Create a shared folder which will be used as working directory.
|
||||
test -d $SOURCE || mkdir $SOURCE
|
||||
# Create a shared folder which will be used as working directory if it
|
||||
# does not already exists.
|
||||
mkdir -p $SOURCE
|
||||
|
||||
# Try to start an existing/stopped container with the given name $CONTAINER. Otherwise, run a new one.
|
||||
docker start -i $CONTAINER 2>/dev/null || docker run -v $SOURCE:/home/cmbuild/android -i -t --name $CONTAINER $REPOSITORY sh -c "screen -s /bin/bash"
|
||||
# Build image if needed
|
||||
IMAGE_EXISTS=$(docker images -q $REPOSITORY)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "docker command not found"
|
||||
exit $?
|
||||
elif [[ -z $IMAGE_EXISTS ]]; then
|
||||
docker build --no-cache --rm -t $REPOSITORY .
|
||||
fi
|
||||
|
||||
# With the given name $CONTAINER, reconnect to running container, start
|
||||
# an existing/stopped container or run a new one if one does not exists.
|
||||
IS_RUNNING=$(docker inspect -f '{{.State.Running}}' $CONTAINER 2>/dev/null)
|
||||
if [[ $IS_RUNNING == "true" ]]; then
|
||||
docker attach $CONTAINER
|
||||
elif [[ $IS_RUNNING == "false" ]]; then
|
||||
docker start -i $CONTAINER
|
||||
else
|
||||
docker run -v $SOURCE:$CONTAINER_HOME/android -i -t --name $CONTAINER $REPOSITORY sh -c "screen -s /bin/bash";
|
||||
fi
|
||||
|
||||
exit $?
|
||||
|
Loading…
Reference in New Issue
Block a user