From 9c9c8bc7d9b1c60f9657feef8d3330cb9fac70b2 Mon Sep 17 00:00:00 2001 From: bry-c Date: Sat, 27 Jun 2020 16:55:51 +0900 Subject: [PATCH 1/3] Docker local development setup --- docker/dev/Dockerfile | 21 +++++++++++++++++++++ docker/dev/requirements.txt | 2 ++ docker/dev/setup.txt | 19 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 docker/dev/Dockerfile create mode 100644 docker/dev/requirements.txt create mode 100644 docker/dev/setup.txt diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile new file mode 100644 index 000000000..e4baeea34 --- /dev/null +++ b/docker/dev/Dockerfile @@ -0,0 +1,21 @@ +# use latest python alphine image. +FROM python:rc-alpine3.12 + +# install system dependencies. +RUN apk update && apk add --no-cache \ + gcc libc-dev g++ graphviz git bash go imagemagick inkscape + +# install go package. +RUN go get github.com/mingrammer/round + +# add go bin to path. +ENV PATH "$PATH:/root/go/bin" + +# project directory. +WORKDIR /usr/src/diagrams + +# Copy the rest of your app's source code from your host to your image filesystem. +COPY . . + +# install python requirements. +RUN pip install -r ./docker/dev/requirements.txt diff --git a/docker/dev/requirements.txt b/docker/dev/requirements.txt new file mode 100644 index 000000000..294444f1e --- /dev/null +++ b/docker/dev/requirements.txt @@ -0,0 +1,2 @@ +diagrams +black \ No newline at end of file diff --git a/docker/dev/setup.txt b/docker/dev/setup.txt new file mode 100644 index 000000000..08bea4bd6 --- /dev/null +++ b/docker/dev/setup.txt @@ -0,0 +1,19 @@ +Docker local development setup. + +1. Go to diagrams project directory. + +2. Build the docker image: +docker build --tag diagrams:1.0 -f ./docker/dev/Dockerfile . + +3. Run the container in background and mount the project source: +docker run -d \ +-it \ +--name diagrams \ +--mount type=bind,source="$(pwd)",target=/usr/src/diagrams \ +diagrams:1.0 + +4. Run unit tests in the host using the container: +docker exec diagrams python -m unittest tests/*.py -v + +5. Run autogen.sh: +docker exec diagrams ./autogen.sh From cc52a893e7a286045bf6d18dc5b4cf6b88dab131 Mon Sep 17 00:00:00 2001 From: bry-c Date: Mon, 29 Jun 2020 23:23:19 +0900 Subject: [PATCH 2/3] Add DEVELOPMENT.md and update dev Dockerfile --- DEVELOPMENT.md | 37 +++++++++++++++++++++++++++++++++++++ docker/dev/Dockerfile | 2 +- docker/dev/requirements.txt | 2 -- 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 DEVELOPMENT.md delete mode 100644 docker/dev/requirements.txt diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 000000000..32aa78c17 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,37 @@ +# Development Guide + +## Docker local development setup + +You should have docker installed in your system, if not click [here](https://docs.docker.com/get-docker/). + +1. Go to diagrams root directory. + +1. Build the docker image. + + ```shell + docker build --tag diagrams:1.0 -f ./docker/dev/Dockerfile . + ``` + +1. Create the container, run in background and mount the project source code. + + ```shell + docker run -d \ + -it \ + --name diagrams \ + --mount type=bind,source="$(pwd)",target=/usr/src/diagrams \ + diagrams:1.0 + ``` + +1. Run unit tests in the host using the container to confirm that it's working. + + ```shell + docker exec diagrams python -m unittest tests/*.py -v + ``` + +1. Run the bash script `autogen.sh` to test. + + ```shell + docker exec diagrams ./autogen.sh + ``` + +1. If the unit tests and the bash script `autogen.sh` is working correctly, then your system is now ready for development. \ No newline at end of file diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index e4baeea34..f5c9b408b 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -18,4 +18,4 @@ WORKDIR /usr/src/diagrams COPY . . # install python requirements. -RUN pip install -r ./docker/dev/requirements.txt +RUN pip install black diff --git a/docker/dev/requirements.txt b/docker/dev/requirements.txt deleted file mode 100644 index 294444f1e..000000000 --- a/docker/dev/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -diagrams -black \ No newline at end of file From a85ca30e74e7225bfe8bfb2c9e927db29274b6c0 Mon Sep 17 00:00:00 2001 From: bry-c Date: Wed, 1 Jul 2020 18:23:51 +0900 Subject: [PATCH 3/3] Delete setup.txt and fix DEVELOPMENT.md sequence --- DEVELOPMENT.md | 10 +++++----- docker/dev/setup.txt | 19 ------------------- 2 files changed, 5 insertions(+), 24 deletions(-) delete mode 100644 docker/dev/setup.txt diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 32aa78c17..8abd48a70 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -6,13 +6,13 @@ You should have docker installed in your system, if not click [here](https://doc 1. Go to diagrams root directory. -1. Build the docker image. +2. Build the docker image. ```shell docker build --tag diagrams:1.0 -f ./docker/dev/Dockerfile . ``` -1. Create the container, run in background and mount the project source code. +3. Create the container, run in background and mount the project source code. ```shell docker run -d \ @@ -22,16 +22,16 @@ You should have docker installed in your system, if not click [here](https://doc diagrams:1.0 ``` -1. Run unit tests in the host using the container to confirm that it's working. +4. Run unit tests in the host using the container to confirm that it's working. ```shell docker exec diagrams python -m unittest tests/*.py -v ``` -1. Run the bash script `autogen.sh` to test. +5. Run the bash script `autogen.sh` to test. ```shell docker exec diagrams ./autogen.sh ``` -1. If the unit tests and the bash script `autogen.sh` is working correctly, then your system is now ready for development. \ No newline at end of file +6. If the unit tests and the bash script `autogen.sh` is working correctly, then your system is now ready for development. \ No newline at end of file diff --git a/docker/dev/setup.txt b/docker/dev/setup.txt deleted file mode 100644 index 08bea4bd6..000000000 --- a/docker/dev/setup.txt +++ /dev/null @@ -1,19 +0,0 @@ -Docker local development setup. - -1. Go to diagrams project directory. - -2. Build the docker image: -docker build --tag diagrams:1.0 -f ./docker/dev/Dockerfile . - -3. Run the container in background and mount the project source: -docker run -d \ --it \ ---name diagrams \ ---mount type=bind,source="$(pwd)",target=/usr/src/diagrams \ -diagrams:1.0 - -4. Run unit tests in the host using the container: -docker exec diagrams python -m unittest tests/*.py -v - -5. Run autogen.sh: -docker exec diagrams ./autogen.sh