first commit
This commit is contained in:
commit
9c60b76f25
|
@ -0,0 +1,43 @@
|
||||||
|
FROM node:6-alpine
|
||||||
|
|
||||||
|
RUN mkdir -p /usr/local/etc \
|
||||||
|
&& { \
|
||||||
|
echo 'install: --no-document'; \
|
||||||
|
echo 'update: --no-document'; \
|
||||||
|
} >> /usr/local/etc/gemrc \
|
||||||
|
&& apk -U upgrade \
|
||||||
|
&& apk add -t build-dependencies \
|
||||||
|
git \
|
||||||
|
curl-dev \
|
||||||
|
wget \
|
||||||
|
ruby-dev \
|
||||||
|
zlib-dev \
|
||||||
|
build-base \
|
||||||
|
mariadb-dev \
|
||||||
|
&& apk add ruby ruby-io-console ruby-json ruby-bigdecimal zlib tzdata mariadb-client-libs \
|
||||||
|
&& gem install -N rails --version "$RAILS_VERSION" \
|
||||||
|
&& echo 'gem: --no-document' >> ~/.gemrc \
|
||||||
|
&& cp ~/.gemrc /etc/gemrc \
|
||||||
|
&& chmod uog+r /etc/gemrc \
|
||||||
|
&& npm install -g bower \
|
||||||
|
&& rm -rf ~/.gem \
|
||||||
|
&& git clone https://github.com/standardfile/ruby-server.git standardfile \
|
||||||
|
&& cd standardfile \
|
||||||
|
&& rm -rf .git/ \
|
||||||
|
&& gem install bigdecimal \
|
||||||
|
&& echo "bundle install" \
|
||||||
|
&& bundle config --global silence_root_warning 1 \
|
||||||
|
&& bundle install --system \
|
||||||
|
&& echo "bower install" \
|
||||||
|
&& bower install --allow-root \
|
||||||
|
&& apk del build-dependencies \
|
||||||
|
&& rm -rf /tmp/* /var/cache/apk/* /tmp/* /root/.gnupg /root/.cache/ \
|
||||||
|
&& echo "bundle precompile" \
|
||||||
|
&& bundle exec rake assets:precompile
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
COPY /docker /docker
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/docker/entrypoint" ]
|
||||||
|
CMD [ "start" ]
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
# $0 is a script name,
|
||||||
|
# $1, $2, $3 etc are passed arguments
|
||||||
|
# $1 is our command
|
||||||
|
CMD=$1
|
||||||
|
|
||||||
|
case "$CMD" in
|
||||||
|
'start' )
|
||||||
|
echo `pwd`
|
||||||
|
rm -f /data/src/tmp/pids/server.pid
|
||||||
|
cd /standardfile/
|
||||||
|
bundle exec rails db:create db:migrate
|
||||||
|
bundle install
|
||||||
|
bower install --allow-root
|
||||||
|
bundle exec rails s -b 0.0.0.0
|
||||||
|
;;
|
||||||
|
|
||||||
|
'bootstrap' )
|
||||||
|
cd /standardfile/
|
||||||
|
bundle exec rails db:create db:migrate
|
||||||
|
;;
|
||||||
|
|
||||||
|
* )
|
||||||
|
# Run custom command. Thanks to this line we can still use
|
||||||
|
# "docker run our_image /bin/bash" and it will work
|
||||||
|
exec "$@"
|
||||||
|
;;
|
||||||
|
esac
|
|
@ -0,0 +1,63 @@
|
||||||
|
upstream puma_sample_rails_docker_app {
|
||||||
|
server app:3000;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
client_max_body_size 4G;
|
||||||
|
keepalive_timeout 10;
|
||||||
|
|
||||||
|
error_page 500 502 504 /500.html;
|
||||||
|
error_page 503 @503;
|
||||||
|
|
||||||
|
server_name localhost puma_sample_rails_docker_app;
|
||||||
|
root /data/src/public;
|
||||||
|
try_files $uri/index.html $uri @puma_sample_rails_docker_app;
|
||||||
|
|
||||||
|
location @puma_sample_rails_docker_app {
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_redirect off;
|
||||||
|
|
||||||
|
proxy_pass http://puma_sample_rails_docker_app;
|
||||||
|
# limit_req zone=one;
|
||||||
|
access_log /data/src/log/nginx.access.log;
|
||||||
|
error_log /data/src/log/nginx.error.log;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ^~ /assets/ {
|
||||||
|
gzip_static on;
|
||||||
|
expires max;
|
||||||
|
add_header Cache-Control public;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /50x.html {
|
||||||
|
root html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /404.html {
|
||||||
|
root html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location @503 {
|
||||||
|
error_page 405 = /system/maintenance.html;
|
||||||
|
if (-f $document_root/system/maintenance.html) {
|
||||||
|
rewrite ^(.*)$ /system/maintenance.html break;
|
||||||
|
}
|
||||||
|
rewrite ^(.*)$ /503.html break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request_method !~ ^(GET|HEAD|PUT|PATCH|POST|DELETE|OPTIONS)$ ){
|
||||||
|
return 405;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-f $document_root/system/maintenance.html) {
|
||||||
|
return 503;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.(php|html)$ {
|
||||||
|
return 405;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue