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

Improve Docker Image and docker-compose.yml #3583

Merged
merged 1 commit into from
Aug 11, 2016
Merged
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
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM python:2.7-onbuild
FROM python:2.7

WORKDIR /usr/src/app
VOLUME ["/usr/app/configs", "/usr/src/app/web"]

ARG timezone=Etc/UTC
RUN echo $timezone > /etc/timezone \
Expand All @@ -15,8 +18,11 @@ RUN cd /tmp && wget "http://pgoapi.com/pgoencrypt.tar.gz" \
&& cd /tmp \
&& rm -rf /tmp/pgoencrypt*

VOLUME ["/usr/src/app/web"]

ENV LD_LIBRARY_PATH /usr/src/app

COPY requirements.txt /usr/src/app/
RUN pip install --no-cache-dir -r requirements.txt

COPY . /usr/src/app

ENTRYPOINT ["python", "pokecli.py"]
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ services:
bot1-pokego:
build: .
volumes:
- ./configs/config.json:/usr/src/app/configs/config.json
- ./configs:/usr/src/app/configs
- ./web:/usr/src/app/web
Copy link
Contributor Author

@lawliet89 lawliet89 Aug 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because when building the image for bot1-pokego, /usr/src/app/web is a volume and anything that is copied into there is ignored.

So we mount ./web as a volume to include the pogoweb files in the container, and also include the json files added in there by the bot.

stdin_open: true
tty: true
bot1-pokegoweb:
image: python:2.7
ports:
- "8000:8000"
volumes_from:
- bot1-pokego
- bot1-pokego
volumes:
- ./configs/userdata.js:/usr/src/app/web/config/userdata.js
- ./configs:/usr/src/app/web/config
working_dir: /usr/src/app/web
command: bash -c "echo 'Serving HTTP on 0.0.0.0 port 8000' && python -m SimpleHTTPServer > /dev/null 2>&1"
depends_on:
- bot1-pokego
- bot1-pokego