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

Add $TIMEZONE environment variable #4954

Merged
merged 1 commit into from
Aug 30, 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
19 changes: 13 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,19 @@ FROM alpine

ARG BUILD_REPO=PokemonGoF/PokemonGo-Bot
ARG BUILD_BRANCH=master
ARG TIMEZONE=Etc/UTC

LABEL build_repo=$BUILD_REPO build_branch=$BUILD_BRANCH

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

RUN apk -U --no-cache add python py-pip \
RUN apk -U --no-cache add python py-pip tzdata \
&& rm -rf /var/cache/apk/* \
&& find / -name '*.pyc' -o -name '*.pyo' | xargs -rn1 rm -f

ADD http://pgoapi.com/pgoencrypt.tar.gz /tmp/pgoencrypt.tar.gz
ADD https://raw.githubusercontent.com/$BUILD_REPO/$BUILD_BRANCH/requirements.txt .
RUN apk -U --no-cache add --virtual .build-dependencies python-dev gcc make musl-dev git tzdata \
&& cp -fa /usr/share/zoneinfo/$TIMEZONE /etc/localtime \
&& echo $TIMEZONE > /etc/timezone \
RUN apk -U --no-cache add --virtual .build-dependencies python-dev gcc make musl-dev git \
&& tar zxf /tmp/pgoencrypt.tar.gz -C /tmp \
&& make -C /tmp/pgoencrypt/src \
&& cp /tmp/pgoencrypt/src/libencrypt.so /usr/src/app/encrypt.so \
Expand All @@ -48,4 +45,14 @@ RUN apk -U --no-cache add --virtual .pgobot-dependencies wget ca-certificates ta
&& apk del .pgobot-dependencies \
&& rm -rf /var/cache/apk/* /tmp/pgobot-version

ENTRYPOINT ["python", "pokecli.py"]
RUN printf "#!/bin/sh\n\
\n\
TIMEZONE=\${TIMEZONE:-Etc/UTC}\n\
\n\
ln -sfn /usr/share/zoneinfo/\$TIMEZONE /etc/localtime\n\
echo \$TIMEZONE > /etc/timezone\n\
\n\
python pokecli.py \$@\n" > /entrypoint.sh \
&& chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ services:
- ./configs:/usr/src/app/configs
- ./data:/usr/src/app/data
- ./web:/usr/src/app/web
environment:
- TIMEZONE=Etc/UTC
stdin_open: true
tty: true
bot1-pokegoweb:
Expand Down
2 changes: 2 additions & 0 deletions docker-compose_tor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ services:
- ./configs:/usr/src/app/configs
- ./data:/usr/src/app/data
- ./web:/usr/src/app/web
environment:
- TIMEZONE=Etc/UTC
stdin_open: true
tty: true
bot1-pokegoweb:
Expand Down