├── Dockerfile ├── README.md └── src ├── initlab └── loop4ever /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | 3 | RUN apt update && apt upgrade -y 4 | RUN ln -fs /usr/share/zoneinfo/Africa/Casablanca /etc/localtime 5 | RUN apt install zsh \ 6 | git \ 7 | vim \ 8 | neovim \ 9 | python3 \ 10 | python3-pip \ 11 | curl \ 12 | wget \ 13 | clang \ 14 | gdb \ 15 | lldb \ 16 | valgrind \ 17 | strace \ 18 | nasm \ 19 | bear \ 20 | ltrace -y 21 | RUN pip3 install norminette c-formatter-42 22 | RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended 23 | RUN curl https://get.volta.sh | bash 24 | RUN /root/.volta/bin/volta install node 25 | RUN chsh -s /bin/zsh 26 | RUN git clone https://github.com/zsh-users/zsh-autosuggestions.git /root/.oh-my-zsh/plugins/zsh-autosuggestions 27 | RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting.git /root/.oh-my-zsh/plugins/zsh-syntax-highlighting 28 | WORKDIR /usr/bin 29 | COPY src/initlab /usr/bin/ 30 | COPY src/loop4ever /usr/bin/ 31 | RUN /usr/bin/initlab 32 | 33 | WORKDIR /src 34 | 35 | CMD ["loop4ever"] 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 42lab 2 | 3 | This docker image contains required tools for developing and debugging your 42 projects, so that you don't have to push your projects with silly leaks. 4 | \*except graphical projects. 5 | 6 | ## Toolbox 🧰 7 | 8 | The image has pretty much all you need in developing & debugging your 42 Projects. 9 | 10 | | TOOL | AVAILABLE | 11 | | --------------- | --------- | 12 | | GCC | ✅ | 13 | | CLANG | ✅ | 14 | | NORMINETTE | ✅ | 15 | | GDB | ✅ | 16 | | LLDB | ✅ | 17 | | VALGRIND | ✅ | 18 | | STRACE | ✅ | 19 | | LTRACE | ✅ | 20 | | NASM | ✅ | 21 | | MAKE | ✅ | 22 | 23 | ## Features 24 | 25 | - Auto import ssh keys out of host machine. 26 | - More to come. 27 | 28 | ## Usage 29 | 30 | DISCLAIMER: If you want to learn docker and how it works and all the fun stuff, this is not the place to do so. Check this out. 31 | 32 | [Docker Tutorial for Beginners](https://www.youtube.com/watch?v=fqMOX6JJhGo). 33 | 34 | ### Downloading the image 35 | 36 | The following command should download the image in your machine. 37 | 38 | ```sh 39 | docker pull ayoubedd/42lab 40 | ``` 41 | 42 | ### Checking the image 43 | 44 | you can check out if the image successfully downloaded by running this command. 45 | 46 | ```sh 47 | docker images 48 | ``` 49 | 50 | You should see the name of the image among others if there is. 51 | 52 | ### Starting the container 53 | 54 | Now that we have the image downloaded, we can start the Container. 55 | 56 | ```sh 57 | docker run -d -v "$HOME/.ssh/":/root/.ssh -v "$(PWD)":/src --name 42lab ayoubedd/42lab 58 | ``` 59 | 60 | \*By running the provided command you are going to launch a new docker container named 42lab and your current working directory is going to be auto mounted in your container, so you can debug your existing projects in your host machine. 61 | 62 | If that doesn't suit, you can make some changes to the command: 63 | 64 | - Change `"$(PWD)"` with the directory you need to be mounted in your container. 65 | - You can add more mount point's from your host machine to your container by simply adding the following flag to each directory you want to add `-v "path in your host mahine":"path in the container"`. 66 | - Change the name of the container `--name 42lab` to `--name something`. 67 | - If you don't need your ssh keys inside your container, you can simply remove the -v "$HOME/.ssh/":/root/.ssh out of the command 68 | 69 | Now, I assume that you have an up and running docker container. 70 | 71 | ### Attach to the Container 72 | 73 | We can attach to the docker container by running the following command. 74 | 75 | ```sh 76 | docker exec -it 42lab zsh 77 | ``` 78 | 79 | If you did change the name of the container in the previous step, you need to change it here too. Just by replacing `42lab` by your custom name. 80 | 81 | Now you realize that you are no longer in the host machine shell, but you are in the containers. 82 | 83 | You can run the `ls` command to list all the files and directories you choose to mount from your host machine. 84 | 85 | ### Exit the container 86 | 87 | When ever you want to leave the container and go back to your host machine shell. Simply run the exit command. 88 | 89 | ```sh 90 | exit 91 | ``` 92 | 93 | ### Stop the container 94 | 95 | if you exit the container, it doesn't mean that it is stopped. You can list the running container running the following command. 96 | 97 | ```sh 98 | docker ps 99 | ``` 100 | to stop the container you need to run the following command. 101 | 102 | ```sh 103 | docker stop 42lab 104 | ``` 105 | *change the name of the container if you did so when you were creating the container. 106 | 107 | 108 | ### Removing the container 109 | 110 | If you done with this crappy conatiner and you wan't to get rid of it. you can run the following command. 111 | 112 | ```sh 113 | docker container rm 42lab 114 | ``` 115 | 116 | ## Congratulations 🎉🎉 117 | 118 | Congrats, now you have a great toolbox for developing and debugging your projects. You have no excuse to leave your programs leak. 119 | -------------------------------------------------------------------------------- /src/initlab: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cat /root/.zshrc | sed 's/^plugins.*$/plugins=(git zsh-syntax-highlighting zsh-autosuggestions)/' > /tmp/.zshrc && 4 | cat /tmp/.zshrc > /root/.zshrc 5 | 6 | 7 | echo " 8 | eval \`ssh-agent\` 1>/dev/null 9 | if [ \"\$?\" -eq 0 ] 10 | then 11 | for i in \$(ls /root/.ssh/*.pub) 12 | do 13 | ssh-add "\$\(echo \$i \| sed 's/.pub//g'\)" 14 | done 15 | fi" >> /root/.zshrc 16 | -------------------------------------------------------------------------------- /src/loop4ever: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while true 4 | do 5 | sleep 3600 6 | done 7 | grep 8 | --------------------------------------------------------------------------------