Skip to content

Commit

Permalink
Docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
xtrime-ru committed Mar 8, 2020
1 parent e17f659 commit 8530c2c
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 12 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# SWOOLE
SERVER_ADDRESS=127.0.0.1
SERVER_PORT=9503

Expand Down
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM php:7.4-cli

COPY . /app
WORKDIR /app

RUN pecl install apcu ev\
&& docker-php-ext-enable apcu \
&& docker-php-ext-enable ev \
&& apt-get update && apt-get install git zip vim nano -y \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer global require hirak/prestissimo

RUN \
[ ! -d "vendor" ] && composer install -o --no-dev; \
\
[ -f ".env" ] && cat .env || cat .env.example \
| sed -e 's/SERVER_ADDRESS=127.0.0.1/SERVER_ADDRESS=0.0.0.0/g' \
| sed -e 's/IP_WHITELIST=127.0.0.1/IP_WHITELIST=/g' \
> .env;

VOLUME ["/app/sessions", "/app/.env:/app/.env"]

EXPOSE 9503

ENTRYPOINT php server.php -s=*
133 changes: 122 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.7'
services:
telegram-api-server:
build: ./
image: telegram-api-server:latest
container_name: telegram-api-server
restart: unless-stopped
ports:
- "127.0.0.1:9503:9503"
logging:
driver: "json-file"
options:
max-size: "1k"
max-file: "1"

0 comments on commit 8530c2c

Please sign in to comment.