Use existing scripts in contrib/docker

This commit is contained in:
Dsaster 2021-02-06 22:07:15 +01:00
parent 563b14a97f
commit 7b7d9ac83e
4 changed files with 29 additions and 29 deletions

View File

@ -60,12 +60,12 @@ If you get an error in saving configuration settings when specifying the license
#### Docker #### Docker
If you find issues building the ROMs with the above methods, you can try the Docker-specific build script. It will build a Docker image with the system requirements above, and run the `make` scripts (any specified parameter will be passed to the `make` command): If you find issues building the ROMs with the above methods, you can try the Docker-specific build script. It will build an Alpine-based Docker image with the system requirements above, and run the `make` scripts (any specified parameter will be passed to the `make` command):
```console ```console
$ make clean $ make clean
$ ./docker/build.sh # build pokediamond $ ./contrib/docker/build_docker.sh # build pokediamond
$ ./docker/build.sh pearl # build pokepearl $ ./contrib/docker/build_docker.sh pearl # build pokepearl
``` ```
Note: Docker may not run at a full performance if its underlying Linux kernel is being virtualized (mainly Windows and macOS hosts). Note: Docker may not run at a full performance if its underlying Linux kernel is being virtualized (mainly Windows and macOS hosts).

View File

@ -5,6 +5,8 @@ apt update && \
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends binutils-arm-none-eabi build-essential git libpng-dev wine wine32 && \ DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends binutils-arm-none-eabi build-essential git libpng-dev wine wine32 && \
rm -r /var/cache/apt/archives /var/lib/apt/lists rm -r /var/cache/apt/archives /var/lib/apt/lists
WORKDIR /app
# Run a persistent wineserver to avoid errors like # Run a persistent wineserver to avoid errors like
# wine: a wine server seems to be running, but I cannot connect to it. # wine: a wine server seems to be running, but I cannot connect to it.
RUN mkdir -p /root/.wine RUN mkdir -p /root/.wine

View File

@ -1,11 +1,29 @@
#!/bin/sh #!/bin/sh
ver="0.1" PROJECT_PATH="$(git rev-parse --show-toplevel)"
PROJECT_NAME="pokediamond"
PROJECT_VER="0.1"
docker inspect pokediamond:$ver > /dev/null # Build container image
if [ $? = 0 ]; then IMAGE_NAME="$PROJECT_NAME:$PROJECT_VER"
echo "Not rebuilding image since image exists"; IMAGE_PATH="$PROJECT_PATH/contrib/docker"
if docker inspect $IMAGE_NAME > /dev/null; then
echo "Not rebuilding image since it already exists";
elif [ "x$USE_UBUNTU" != "x" ]; then
docker build -t $IMAGE_NAME -f $IMAGE_PATH/Dockerfile.ubuntu $IMAGE_PATH
else else
docker build -t pokediamond:$ver $(git rev-parse --show-toplevel)/contrib/docker docker build -t $IMAGE_NAME $IMAGE_PATH
fi fi
docker run --network=none -it -v $(git rev-parse --show-toplevel):/app pokediamond:$ver
# Start container and wine server
CONTAINER_NAME="$PROJECT_NAME-build"
docker run -d --name $CONTAINER_NAME --network=none -it --rm -v $PROJECT_PATH:/app $IMAGE_NAME
# Build selected project, always exit successfully to ensure container stops
EXIT_CODE="0"
docker exec -i -t $CONTAINER_NAME make $@ || EXIT_CODE="$?"
# Exit and remove the container
docker stop $CONTAINER_NAME
exit $EXIT_CODE

View File

@ -1,20 +0,0 @@
#!/bin/bash
set -eou pipefail
PROJECT_NAME=${PROJECT_NAME:-pokediamond}
PROJECT_PATH=${PROJECT_PATH:-$(dirname $(pwd))}
# Build container image
IMAGE_NAME=${IMAGE_NAME:-$PROJECT_NAME-image}
docker build -t $IMAGE_NAME .
# Start container and wine server
CONTAINER_NAME=${CONTAINER_NAME:-$PROJECT_NAME}
docker run -d -i --name $CONTAINER_NAME --rm -t -v $PROJECT_PATH:/$PROJECT_NAME -w /$PROJECT_NAME $IMAGE_NAME
# Build selected project, always exit successfully to ensure container stops
docker exec -i -t $CONTAINER_NAME make $@ || true
# Exit the container and remove
docker stop $CONTAINER_NAME