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

docker-compose support #27

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
44 changes: 44 additions & 0 deletions docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -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
<br>`cd docker-compose`
* Start the build
<br> docker-compose -f docker-compose.yml up -d --build <br>
* Stop container
<br>`docker-compose stop`
* Start docker container
<br>`docker-compose start`
* Stop and remove Docker configs
<br>`docker-compose down`
* Display output logs
<br>`docker logs -f instapy_dashboard_1`
* To see if the container is running
<br>`docker ps`
5 changes: 5 additions & 0 deletions docker-compose/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
6 changes: 6 additions & 0 deletions docker-compose/build/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
cd /code
if [ ! -d "/code/node_modules/" ]; then
npm install
fi
npm start
22 changes: 22 additions & 0 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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