Adding Docker Support (#914)

* Adding dockerfile and instructions for building

* fixing readme and updating Dockerfile

* Adding packages and practicerom support
This commit is contained in:
Parker Burnett 2022-07-11 20:54:17 -07:00 committed by GitHub
parent 87506f7c19
commit 66c4d743b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 97 additions and 4 deletions

42
Dockerfile Normal file
View File

@ -0,0 +1,42 @@
FROM ubuntu:22.04 as build
ENV TZ=UTC
# Install Required Dependencies
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt-get update && apt-get install -y \
curl \
build-essential \
binutils-mips-linux-gnu \
pkg-config \
python3 \
python3-pip \
git \
wget \
unzip \
vbindiff \
vim \
clang-tidy-11 \
clang-format-11 \
libpng-dev && \
apt clean && \
rm -rf /var/lib/apt/lists/*
# Install practicerom
RUN curl https://practicerom.com/public/packages/debian/pgp.pub | \
apt-key add - && echo deb http://practicerom.com/public/packages/debian staging main >/etc/apt/sources.list.d/practicerom.list && apt update
RUN apt-get install -y practicerom-dev
COPY requirements.txt requirements.txt
RUN python3 -m pip install --no-cache-dir -r requirements.txt
ENV LANG C.UTF-8
RUN mkdir /mm
WORKDIR /mm
RUN git config --global --add safe.directory /mm
ENTRYPOINT ["/bin/bash", "-c"]

View File

@ -28,15 +28,16 @@ This is a WIP **decompilation** of ***The Legend of Zelda: Majora's Mask***. The
The only version currently supported is N64 US, but we intend to eventually support every retail version of the original game (i.e. not versions of MM3D, which is a totally different game).
It currently builds the following ROM:
* mm.us.rev1.rom.z64 `md5: 2a0a8acb61538235bc1094d297fb6556`
**This repo does not include any assets or assembly code necessary for compiling the ROM. A prior copy of the game is required to extract the required assets.**
Please refer to the following for more information:
* [Website](https://zelda64.dev/)
* [Discord](https://discord.zelda64.dev/)
* [How to Contribute](docs/CONTRIBUTING.md)
- [Website](https://zelda64.dev/)
- [Discord](https://discord.zelda64.dev/)
- [How to Contribute](CONTRIBUTING.md)
## Installation
@ -50,6 +51,10 @@ We recommend using Debian or Ubuntu 20.04 Linux distributions.
Preparation is covered in a [separate document](docs/BUILDING_MACOS.md).
### Docker
Preparation is covered in [Building Docker](docs/BUILDING_DOCKER.md).
### Linux (Native or under WSL / VM)
#### 1. Install build dependencies
@ -130,7 +135,6 @@ Running `make init` will also make the `./expected` directory and copy all of th
The disadvantage that the ordering of the terminal output is scrambled, so for debugging it is best to stick to one thread (i.e. not pass `-jN`).
(`-j` also exists, which uses unlimited jobs, but is generally slower.)
## Contributing
All contributions are welcome. This is a group effort, and even small contributions can make a difference.

47
docs/BUILDING_DOCKER.md Normal file
View File

@ -0,0 +1,47 @@
# Building using Docker
## Dependencies
You will need [Docker](https://docs.docker.com/get-docker/) Follow the instructions for your operating system.
## 1. Clone the Repository
You will need to prepare a local version of the project with a copied base ROM (see steps [2](../README.md#2-clone-the-repository) and [4](../README.md#4-prepare-a-base-rom) of the Linux instructions).
## 2. Create the Docker image
From inside your local project, run the following command:
```bash
docker build . -t mm
```
This will build a docker image with the name of `mm`, to verify the image was made you can run the command
```bash
docker image ls
```
and look for `mm` under the "REPOSITORY" column.
## 3. Start the container
To start the container, you can mount your local filesystem into the Docker container and run an interactive bash session.
```bash
docker run -it --rm --mount type=bind,source="$(pwd)",destination=/mm mm /bin/bash
```
- The `-it` flags Keep STDIN open even if not attached to the container and allocates a pseudo-tty terminal.
- The `--rm` flags causes Docker to automatically remove the container when it exits.
- The `--mount` flag allows you to mount volumes and host-directories in a container. By specifying the type to be a bind, we are saying there are files to be mounted from the host machine (the one that runs your docker daemon) onto the container. Source is specifying where we are mounting the files from in this case, we want the `mm` folder created earlier. The $(pwd) sub-command expands to the current working directory. The destination takes as its value the path where the file or directory is mounted in the container. This makes it so that the image should rarely change and will reduce the need to rebuild with any change to the codebase.
## 4. Setup and Build the ROM
Once inside the container, you will need to set the repository as a trusted repository with the following command:
```bash
git config --global --add safe.directory /mm
```
After that continue with step [5. Make and Build the ROM](../README.md#5-make-and-build-the-rom) of the Linux instructions to setup and build the ROM, or run any other command you need.