Hi All,
It might be easier to have the user simply build the code inside a Docker container and then run the compiled game
file outside the container. A clang development environment in a container would benefit many non-clang developers and help them to get started with the minecraft-weekend
project.
The below scrips are how I got this project to work on my Linux machine. Hopefully they will be helpful to others, as well.
Docker
To use the below code, place the below scripts into the specified filenames. Then, place these files in the root of the minecraft-weekend
project.
To build the development container, use the build
script. To run the container where the user will be able to compile the minecraft-weekend
project, use the run
script. Once inside the container, the commands to compile the project will work.
Note_1: The Unix command to complete this task is; chmod +x build_linux.sh run_linux.sh
.
Note_2: To run the minecraft-weekend
project, the user must exit the container and run bin/game
from outside the bin/
directory.
Dockerfile
File contents:
FROM ubuntu:20.04
####################
# clang development
####################
RUN apt update && apt install cmake libxss-dev libxxf86vm-dev libxkbfile-dev libxv-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev clang -y
WORKDIR /root
CMD ["bash"]
Build scripts (Linux)
The below files are to help less-experienced users to build and run a Docker container.
Build File: build_linux.sh
File contents:
# MacOS and Ubuntu container builder and executer
# Formatting
GREEN='\033[0;32m' # Green
BIGreen='\033[1;92m' # Green
NC='\033[0m' # No Colour
# Say something nice to the user. Note, $USER, is login account credential.
# Type 'whoami' to see who you are in Linux.
printf "\n [+] ${BIGreen} Hello ${USER}! Building your working container.${NC}\n [+] ${BIGreen}You may be asked to enter your password.${NC}\n"
# Build container:
sudo docker build -t developer .
Run File: run_linux.sh
File contents:
#!/bin/bash
# MacOS and Ubuntu container builder and executer
# Formatting
GREEN='\033[0;32m' # Green
BIGreen='\033[1;92m' # Green
NC='\033[0m' # No Colour
# Say something nice to the user. Note, $USER, is login account credential.
# Type 'whoami' to see who you are in Linux.
printf "\n [+] ${BIGreen} Hello ${USER}! Setting up your working container.${NC}\n [+] ${BIGreen}You may be asked to enter your password.${NC}\n"
# Run container:
sudo docker run --rm -it -v "$PWD:/root" developer
printf "\n [+] ${BIGreen} Returning file ownership from root to ${USER}.\n You may be asked to reenter your password.${NC}\n"
# change ownership of a file to your own login if it was created in the docker container.
sudo chown $USER ./*
# sudo chown $USER vids/*
printf "\n [+] ${BIGreen} The working container is now closed. ${NC}\n"
Now, just build and run your container, navigate to the project repository directory and use make
to build the project.
Although I have tested these scripts for this project, please edit as necessary if you find any errors. If you can think of anyway to get the graphics of the minecraft-weekend
project to play out of a Docker container (thus, allowing other OS' to host and play the game), please let me know.
Keep-up the development of this project!!
Cheers,
Oliver Bonham-Carter