From eef343b71fcf4e57b5ef5d9df3f76011226e5bf0 Mon Sep 17 00:00:00 2001 From: bry-c Date: Wed, 1 Jul 2020 18:27:15 +0900 Subject: [PATCH] Docker local development setup (#210) * Docker local development setup * Add DEVELOPMENT.md and update dev Dockerfile * Delete setup.txt and fix DEVELOPMENT.md sequence --- DEVELOPMENT.md | 37 +++++++++++++++++++++++++++++++++++++ docker/dev/Dockerfile | 21 +++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 DEVELOPMENT.md create mode 100644 docker/dev/Dockerfile diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..8abd48a --- /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. + +2. Build the docker image. + + ```shell + docker build --tag diagrams:1.0 -f ./docker/dev/Dockerfile . + ``` + +3. 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 + ``` + +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 + ``` + +5. Run the bash script `autogen.sh` to test. + + ```shell + docker exec diagrams ./autogen.sh + ``` + +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/Dockerfile b/docker/dev/Dockerfile new file mode 100644 index 0000000..f5c9b40 --- /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 black