diff --git a/docker-compose/README.md b/docker-compose/README.md new file mode 100644 index 0000000..14f92bf --- /dev/null +++ b/docker-compose/README.md @@ -0,0 +1,44 @@ +# instapy-dashboard with docker-compose + +## Pre-requierments +Make sure that the instapy-docker folder (yes, that is an assumption as you will run this in docker) is on the same level in the tree as the instapy-dashboard is, else you need to change volume mount in the docker-compose.yaml (../../instapy-docker/docker-compose/InstaPy/) + +Change the .env file to the following values, +INSTAPY_FOLDER=/code/InstaPy +ALLOWED_HOSTS=http://*:3000 + +Example .env file +``` +# MacOS: /Users/your_user_name/InstaPy +# you can also check this information when running your quickstart.py, +# the first lines contains +# -> Workspace in use: "/Users/converge/InstaPy" +INSTAPY_FOLDER=/code/InstaPy +# if using only on localhost, keep it: +#ALLOWED_HOSTS=http://localhost:3000 http://192.168.0.100:3000 +ALLOWED_HOSTS=http://*:3000 +REACT_APP_API_ENTRY_POINT=http://localhost:3001 + +# basic setup, ok to keep it -> +# Node port +NODE_PORT=3001 +# ReactJS Create APP port +PORT=3000 +``` +## Usage +* Tested on a ubuntu 18.04 running docker 17.12.1-ce and docker-compose 1.18.0 +* Make sure you have the .env file set tin the root folder +* Change your directory to docker-compose +
`cd docker-compose` +* Start the build +
docker-compose -f docker-compose.yml up -d --build
+* Stop container +
`docker-compose stop` +* Start docker container +
`docker-compose start` +* Stop and remove Docker configs +
`docker-compose down` +* Display output logs +
`docker logs -f instapy_dashboard_1` +* To see if the container is running +
`docker ps` diff --git a/docker-compose/build/Dockerfile b/docker-compose/build/Dockerfile new file mode 100644 index 0000000..42c914a --- /dev/null +++ b/docker-compose/build/Dockerfile @@ -0,0 +1,5 @@ +FROM node:11 +WORKDIR /code +COPY ./build/entrypoint.sh /root +RUN /bin/chmod +x /root/entrypoint.sh +CMD [ "/root/entrypoint.sh"] diff --git a/docker-compose/build/entrypoint.sh b/docker-compose/build/entrypoint.sh new file mode 100755 index 0000000..6e64c88 --- /dev/null +++ b/docker-compose/build/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +cd /code +if [ ! -d "/code/node_modules/" ]; then + npm install +fi +npm start diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml new file mode 100644 index 0000000..59d590e --- /dev/null +++ b/docker-compose/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3' +services: + dashboard: +# environment: +# - PYTHONUNBUFFERED=0 +# - INSTAPY_WORKSPACE=/code/InstaPy + build: + context: . + dockerfile: ./build/Dockerfile +# depends_on: +# - selenium + volumes: + - ../:/code + - ../../instapy-docker/docker-compose/InstaPy/:/code/InstaPy +# - ../../instapy-docker/docker-compose/InstaPy/db/:/code/db + +# selenium: +# image: selenium/standalone-chrome + ports: + - "127.0.0.1:3000:3000" + - "127.0.0.1:3001:3001" + shm_size: 128M