Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dockerized Ubuntu environment #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docker-ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM dorowu/ubuntu-desktop-lxde-vnc:focal

WORKDIR /root/project

# Install dependencies
# See: https://github.com/cpp-io2d/P0267_RefImpl/blob/P0267R8/BUILDING.md
RUN apt update && \
apt install -y build-essential && \
apt install -y cmake && \
apt install -y libcairo2-dev && \
apt install -y libgraphicsmagick1-dev && \
apt install -y libpng-dev && \
apt install -y git

# Install VS Code
# See: https://code.visualstudio.com/docs/setup/linux
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg && \
install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/ && \
sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' && \
apt-get install apt-transport-https && \
apt-get update && \
apt-get install code

# Install IO2D
RUN git clone --recurse-submodules https://github.com/cpp-io2d/P0267_RefImpl && \
cd P0267_RefImpl && \
mkdir Debug && \
cd Debug && \
cmake --config Debug "-DCMAKE_BUILD_TYPE=Debug" .. && \
cmake --build . && \
make install
42 changes: 42 additions & 0 deletions docker-ubuntu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Container environment

This provides a Dockerfile which can be used to build a Docker image locally and run a container for the environment setup of this project. It is an Ubuntu environemt with an LXDE desktop, based on an [existing Docker image](https://hub.docker.com/r/dorowu/ubuntu-desktop-lxde-vnc/). The instructions on the Dockerfile install all the needed dependencies, including VS Code and IO2D.

## Setup

* Clone the project or your own fork:

```
git clone --recurse-submodules https://github.com/udacity/CppND-Route-Planning-Project
```

* Build the Docker image:

```bash
docker build -t environment-cpp-project-1 .
```

* Run the Docker container, by mounting the project's directory from your host to the container:

```bash
docker run -p 6080:80 -v /dev/shm:/dev/shm \
-v <path-to-project>:/root/project/CppND-Route-Planning-Project \
environment-cpp-project-1
```

* Open `http://localhost:6080/` on your browser to see the Ubuntu Desktop.

* Open the terminal in Ubuntu to build and execute the project:

```bash
cd /root/project/CppND-Route-Planning-Project
mkdir build
cd build
cmake ..
make
./OSM_A_star_search
```

You should see the output below and at this point can continue working locally on the project.

![alt text](Ubuntu_Desktop.png "Ubuntu Desktop")
Binary file added docker-ubuntu/Ubuntu_Desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.