From fca0331defc0ca65430544d97220d776043a3673 Mon Sep 17 00:00:00 2001 From: Lorenzooone Date: Thu, 30 Dec 2021 19:45:42 +0100 Subject: [PATCH] Use multi-stage to save space on tester docker --- docker-scripts/build-dockers/Dockerfile | 21 +++++++++++++++---- docker-scripts/build-dockers/build-builder.sh | 2 +- docker-scripts/build-dockers/build-tester.sh | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) mode change 100644 => 100755 docker-scripts/build-dockers/build-builder.sh mode change 100644 => 100755 docker-scripts/build-dockers/build-tester.sh diff --git a/docker-scripts/build-dockers/Dockerfile b/docker-scripts/build-dockers/Dockerfile index bd2c8d9..b47b03a 100644 --- a/docker-scripts/build-dockers/Dockerfile +++ b/docker-scripts/build-dockers/Dockerfile @@ -12,6 +12,8 @@ RUN ./dotnet-install.sh -c 2.1 RUN echo "-------------------Installing armips------------------" RUN git clone --recursive https://github.com/Kingcom/armips.git WORKDIR /opt/dep/armips +# Need a buildable commit... +RUN git checkout d481fe7a48b3ef02ce5358291a240819ff5742f1 RUN mkdir -p bld WORKDIR /opt/dep/armips/bld RUN cmake ../ @@ -28,19 +30,30 @@ WORKDIR /opt/src USER m2gba CMD /home/m2gba/src/docker-scripts/docker-build-rom-script -#------------------- Building the Tester --------------------- -FROM builder AS tester +#---------------------- Building mgba ------------------------ +FROM builder AS mgba_builder USER root RUN apt-get update && \ apt-get install -y --no-install-recommends build-essential ccache cmake \ git libavcodec-dev libavfilter-dev libavformat-dev libavresample-dev \ libavutil-dev libcmocka-dev libedit-dev libelf-dev libpng-dev \ libqt5opengl5-dev libsdl2-dev libsqlite3-dev libswscale-dev \ - libzip-dev qtmultimedia5-dev qttools5-dev qttools5-dev-tools xvfb pulseaudio alsa-utils && \ + libzip-dev qtmultimedia5-dev qttools5-dev qttools5-dev-tools && \ apt-get autoremove -y && apt-get clean WORKDIR /home/m2gba USER m2gba RUN git clone https://github.com/mgba-emu/mgba.git -RUN cd mgba && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .. && make && cp sdl/mgba /opt/src/bin/mgba-sdl +RUN cd mgba && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .. && make + +#------------------- Building the Tester --------------------- +FROM builder AS tester +USER root +RUN apt-get update && \ + apt-get install -y --no-install-recommends xvfb pulseaudio alsa-utils libsdl2-dev \ + libzip-dev libavcodec-dev libavfilter-dev && \ + apt-get autoremove -y && apt-get clean WORKDIR /opt/src +USER m2gba +COPY --from=mgba_builder /home/m2gba/mgba/build/sdl/mgba ./bin/mgba-sdl +COPY --from=mgba_builder /home/m2gba/mgba/build/libmgba* ./ CMD /home/m2gba/src/docker-scripts/docker-test-rom-script diff --git a/docker-scripts/build-dockers/build-builder.sh b/docker-scripts/build-dockers/build-builder.sh old mode 100644 new mode 100755 index 0d5a7c8..cefbe2c --- a/docker-scripts/build-dockers/build-builder.sh +++ b/docker-scripts/build-dockers/build-builder.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker rm image lorenzooone/m2gba_translation:builder +docker image rm lorenzooone/m2gba_translation:builder docker build --target builder . -t lorenzooone/m2gba_translation:builder diff --git a/docker-scripts/build-dockers/build-tester.sh b/docker-scripts/build-dockers/build-tester.sh old mode 100644 new mode 100755 index e242ac8..5acb91b --- a/docker-scripts/build-dockers/build-tester.sh +++ b/docker-scripts/build-dockers/build-tester.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker rm image lorenzooone/m2gba_translation:tester +docker image rm lorenzooone/m2gba_translation:tester docker build --target tester . -t lorenzooone/m2gba_translation:tester