This project uses a Docker-based development environment managed through Visual Studio Code's Remote - Containers extension. This setup ensures a consistent development environment for all contributors, avoiding the "works on my machine" problem.
Before you begin, make sure you have the following installed:
- Docker: Ensure Docker Desktop (Windows/Mac) or Docker Engine (Linux) is installed and running. Get Docker
- Visual Studio Code: Download and install VS Code if you haven't already. Download VS Code
- Remote - Containers Extension: Install the "Remote - Containers" extension in VS Code. You can find it by searching for "Remote - Containers" in the VS Code Extensions View (
Ctrl+Shift+X
).
Follow these steps to set up and start using the development environment:
Start by cloning the repository to your local machine:
git clone https://github.com/MrCan7/vizdoom_il.git
cd vizdoom_il
Open the cloned repository in Visual Studio Code. You can do this from the command line by running:
code .
Once VS Code is open, you'll be prompted to reopen the project in a container. You can also manually reopen the project in the container by:
- Opening the Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
on macOS). - Typing "Remote-Containers: Reopen in Container" and pressing Enter.
VS Code will build the Docker image based on the provided Dockerfile
and devcontainer.json
configurations and then start a container.
After the container is set up, you can start coding right away. The development environment, including all dependencies and configurations, will be exactly as specified in the Docker setup.
If you need to use the Docker environment without VS Code, you can do so by building and running the container directly from the command line:
docker build -t vizdoom-dev .
docker run -it \
-e DISPLAY=${DISPLAY} \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $(pwd):/workspace \
-p 5029:5029 \
--name vizdoom-container \
--user dev \
vizdoom-dev
This command starts the container with the necessary settings for X11 forwarding (for GUI applications), binds the necessary ports, and ensures you are operating within the designed environment.
This guide covers the basic commands needed to manage and interact with the ViZDoom Docker container. The container is configured to use a non-root user, dev
, for executing commands.
- Docker must be installed on your system.
- Ensure the ViZDoom container (
vizdoom-container
) is built and running.
To open a bash shell inside the container as the non-root user dev
, use the following command:
docker exec -it --user dev vizdoom-container /bin/bash
To stop the running container, use the following command:
docker stop vizdoom-container
If your container is stopped and you wish to start it again, use the following command:
docker start vizdoom-container
To completely remove the container (note: this does not remove the Docker image), use the following command:
docker rm vizdoom-container
- ViZDoom: The ViZDoom environment is fully set up and ready to be used or developed upon.
- Python: The container includes a Conda environment with Python 3.11, optimized for working with ViZDoom.
- Tools and Extensions: Pre-installed VS Code extensions and tools for Python development, CMake project management, Git integration, and Docker management.
To build the Docker image manually or to rebuild it, you can use:
docker build -t vizdoom-dev .
To run the container manually (without VS Code), use:
docker run -d --name my-vizdoom-dev -p 5029:5029 vizdoom-dev
If you encounter any issues with the DevContainer setup, try the following:
- Rebuild Container: Open the Command Palette and select "Remote-Containers: Rebuild Container".
- Check Docker: Ensure Docker is running correctly on your machine. Restart Docker if necessary.
- Logs: Check the Docker and VS Code logs for any error messages that might provide more insight.
Contributions are welcome! Please feel free to submit pull requests or open issues for any improvements or bug fixes.