Use multi-stage building for docker
This commit is contained in:
parent
71b13445b6
commit
ff47b3076d
|
@ -73,7 +73,7 @@ The output will be inside the newly created `out` folder.
|
||||||
# Testing
|
# Testing
|
||||||
|
|
||||||
## Testing with Docker
|
## Testing with Docker
|
||||||
Docker allows easily building without having to install the dependencies.
|
Docker allows easily testing without having to install the dependencies.
|
||||||
|
|
||||||
1. Put a MOTHER 1+2 ROM in `bin/m12fresh.gba`
|
1. Put a MOTHER 1+2 ROM in `bin/m12fresh.gba`
|
||||||
2. While in the root of the project, run: `docker run --rm -it -v $PWD:/home/m2gba/src lorenzooone/m2gba_translation:tester`
|
2. While in the root of the project, run: `docker run --rm -it -v $PWD:/home/m2gba/src lorenzooone/m2gba_translation:tester`
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
docker rm image mother2gba:build
|
|
||||||
docker build . -t mother2gba:build
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM mcr.microsoft.com/powershell:ubuntu-20.04
|
FROM mcr.microsoft.com/powershell:ubuntu-20.04 AS builder
|
||||||
RUN echo "------------------Updating System------------------"
|
RUN echo "------------------Updating System------------------"
|
||||||
RUN apt update
|
RUN apt update
|
||||||
RUN apt upgrade
|
RUN apt upgrade
|
||||||
|
@ -27,3 +27,20 @@ RUN chown -R m2gba:m2gba /home/m2gba && chown -R m2gba:m2gba /opt/src
|
||||||
WORKDIR /opt/src
|
WORKDIR /opt/src
|
||||||
USER m2gba
|
USER m2gba
|
||||||
CMD /home/m2gba/src/docker-scripts/docker-build-rom-script
|
CMD /home/m2gba/src/docker-scripts/docker-build-rom-script
|
||||||
|
|
||||||
|
#------------------- Building the Tester ---------------------
|
||||||
|
FROM builder AS tester
|
||||||
|
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 && \
|
||||||
|
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
|
||||||
|
WORKDIR /opt/src
|
||||||
|
CMD /home/m2gba/src/docker-scripts/docker-test-rom-script
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
docker rm image lorenzooone/m2gba_translation:builder
|
||||||
|
docker build --target builder . -t lorenzooone/m2gba_translation:builder
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
docker rm image lorenzooone/m2gba_translation:tester
|
||||||
|
docker build --target tester . -t lorenzooone/m2gba_translation:tester
|
|
@ -1,15 +0,0 @@
|
||||||
FROM lorenzooone/m2gba_translation: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 && \
|
|
||||||
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
|
|
||||||
WORKDIR /opt/src
|
|
||||||
CMD /home/m2gba/src/docker-scripts/docker-test-rom-script
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
docker rm image mother2gba:test
|
|
||||||
docker build . -t mother2gba:test
|
|
Loading…
Reference in New Issue