Update Dockerfile, add docker-compose for prod and dev environment, cleanup some old things

This commit is contained in:
ErickSkrauch 2018-02-16 00:01:46 +03:00
parent 55f52d0ad4
commit acd0237fac
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E
12 changed files with 69 additions and 154 deletions

View File

@ -1,5 +1,2 @@
# Игнорим данные, т.к. они не нужны для внутреннего содержимого этого контейнера
data
# Vendor так же не нужен
vendor

18
.gitignore vendored
View File

@ -1,15 +1,5 @@
# IDEA
/.idea
# Docker Compose file
/docker-compose.yml
/docker-compose.override.yml
# vendor
/vendor
# Cover output
.idea
docker-compose.yml
docker-compose.override.yml
vendor
.cover
# Local config
/config.yml

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM alpine:3.7
EXPOSE 80
ENV STORAGE_REDIS_HOST=redis
ENV STORAGE_FILESYSTEM_HOST=/data
COPY docker-entrypoint.sh /usr/local/bin/
COPY release/chrly /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["serve"]

View File

@ -1,31 +0,0 @@
# Main server configuration. Actually you don't want to change it,
# but you able to change host or port, that will be used by serve command
server:
host: localhost
port: 80
# Both of web or worker depends on storage.
storage:
# For now app require Redis and don't support any other backends to store
# skins, but in the future we can have more backends. Poll size tune amount
# of connections to the redis. It's not recommended to set it less then 2
# because it will lead to panic on high load.
redis:
host: localhost
port: 6379
poolSize: 10
# Filesystem storage used to store capes. basePath specify absolute or relative
# path to storage and capesDirName specify which folder in this base path will
# be used to search capes.
filesystem:
basePath: data
capesDirName: capes
# StatsD can be used to collect metrics
# statsd:
# addr: localhost:3746
# Sentry can be used to collect app errors
# sentry:
# dsn: "https://public:private@your.sentry.io/1"

14
docker-compose.dev.yml Normal file
View File

@ -0,0 +1,14 @@
# This file can be used to start up necessary services.
# Copy it into the docker-compose.yml:
# > cp docker-compose.dev.yml docker-compose.yml
# And then run it:
# > docker-compose up -d
version: '2'
services:
redis:
image: redis:4.0-32bit
ports:
- "6379:6379"
volumes:
- ./data/redis:/data

27
docker-compose.prod.yml Normal file
View File

@ -0,0 +1,27 @@
# This file can be used to run application in the production environment.
# Copy it into the docker-compose.yml:
# > cp docker-compose.prod.yml docker-compose.yml
# And then run it:
# > docker-compose up -d
# Service will be listened at the http://localhost
version: '2'
services:
app:
image: elyby/chrly
hostname: chrly0
restart: always
links:
- redis
volumes:
- ./data/capes:/data/capes
ports:
- "80:80"
environment:
CHRLY_SECRET: replace_this_value_in_production
redis:
image: redis:4.0-32bit # 32-bit version is recommended to spare some memory
restart: always
volumes:
- ./data/redis:/data

12
docker-entrypoint.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -e
if [ ! -d /data/capes ]; then
mkdir -p /data/capes
fi
if [ "$1" = "serve" ] || [ "$1" = "token" ] || [ "$1" = "version" ]; then
set -- /usr/local/bin/chrly "$@"
fi
exec "$@"

View File

@ -1,13 +0,0 @@
FROM alpine:3.6
RUN apk --update add ca-certificates \
&& update-ca-certificates \
&& rm -rf /var/cache/apk/*
COPY docker/docker-entrypoint.sh /usr/local/bin/
COPY docker/config.dist.yml /usr/local/etc/minecraft-skinsystem/
COPY minecraft-skinsystem /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["serve"]

View File

@ -1,31 +0,0 @@
# Main server configuration. Actually you don't want to change it,
# but you able to change host or port, that will be used by serve command
server:
host: # leave host empty to allow Docker publish port
port: 80
# Both of web or worker depends on storage.
storage:
# For now app require Redis and don't support any other backends to store
# skins, but in the future we can have more backends. Poll size tune amount
# of connections to the redis. It's not recommended to set it less then 2
# because it will lead to panic on high load.
redis:
host: redis
port: 6379
poolSize: 10
# Filesystem storage used to store capes. basePath specify absolute or relative
# path to storage and capesDirName specify which folder in this base path will
# be used to search capes.
filesystem:
basePath: /data
capesDirName: capes
# StatsD can be used to collect metrics
# statsd:
# addr: localhost:3746
# Sentry can be used to collect app errors
# sentry:
# dsn: https://public:private@your.sentry.io/1

View File

@ -1,29 +0,0 @@
# This compose file contains necessary docker-compose config to quick start
# services required by app. Ports published to host.
#
# Usage:
# 1. Clone this file as docker-compose.yml:
# cp docker/docker-compose.dev.yml docker-compose.yml
#
# 2. If necessary, then you can fix configuration to your environment.
# Then start all services:
# docker-compose up -d
#
# 3. Pass to the project configuration links to this services:
# storage:
# redis:
# host: localhost
# port: 6379
# poolSize: 10
#
# 4. After job is done all services can be stopped:
# docker-compose stop
version: '2'
services:
redis:
image: redis:3.2-32bit
ports:
- "6379:6379"
volumes:
- ./data/redis:/data

View File

@ -1,18 +0,0 @@
version: '2'
services:
web:
image: registry.ely.by/elyby/skinsystem:latest
restart: always
ports:
- "80:80"
links:
- redis
volumes:
- ./data/capes:/data/capes
- ./config/minecraft-skinsystem:/etc/minecraft-skinsystem
redis:
image: redis:3.2-32bit # 32-bit version used to decrease memory usage
restart: always
volumes:
- ./data/redis:/data

View File

@ -1,15 +0,0 @@
#!/bin/sh
set -e
CONFIG="/etc/minecraft-skinsystem/config.yml"
if [ ! -f "$CONFIG" ]; then
mkdir -p $(dirname "${CONFIG}")
cp /usr/local/etc/minecraft-skinsystem/config.dist.yml "$CONFIG"
fi
if [ "$1" = "serve" ] || [ "$1" = "token" ] || [ "$1" = "version" ]; then
set -- minecraft-skinsystem "$@"
fi
exec "$@"