Skip to content

Instantly share code, notes, and snippets.

@wshihadeh
wshihadeh / config.rb
Created February 26, 2020 22:43
lograge config
config.x.feature.lograge = ENV.fetch("LOGRAGE", 'false') == 'true'
@wshihadeh
wshihadeh / Dockerfile
Created February 27, 2020 07:53
Dockerfile
ENV PORT 8080
ENV RACK_ENV=production RAILS_ENV=production
ENV RAILS_LOG_TO_STDOUT=true
ENV SECRET_KEY_BASE changeme
EXPOSE 8080
HEALTHCHECK CMD curl --fail http://localhost:8080/ || exit 1
@wshihadeh
wshihadeh / Dockerfile
Created February 27, 2020 07:54
Dockerfile
RUN addgroup -g 1000 rails && \
adduser -S -G rails -u 1000 -h /application rails && \
chown -R rails /usr/local/bundle && \
apk update && \
apk add linux-headers build-base curl zlib-dev libxml2-dev libxslt-dev tzdata yaml-dev git nodejs file zip unzip && \
rm -rf /var/cache/apk/*
@wshihadeh
wshihadeh / Dockerfile
Created February 27, 2020 07:55
Dockerfile
USER rails
RUN gem install bundler && \
bundle config build.nokogiri --use-system-libraries && \
rm -rf /usr/lib/lib/ruby/gems/*/cache/*
@wshihadeh
wshihadeh / Dockerfile
Created February 27, 2020 07:56
Dockerfile
ONBUILD ADD . /application
ONBUILD RUN chown -R rails /application
@wshihadeh
wshihadeh / Dockerfile
Created February 27, 2020 08:01
Dockerfile
apk add linux-headers build-base curl zlib-dev libxml2-dev libxslt-dev tzdata yaml-dev git nodejs file zip unzip <%= additional_pkgs.join(" ") %> && \
@wshihadeh
wshihadeh / generate.sh
Created February 27, 2020 08:03
RailsBaseImages
#!/usr/bin/env ruby
RailsBaseImages::DockerFilesCreator.new.call
@wshihadeh
wshihadeh / build.sh
Last active February 27, 2020 08:04
Build and Push
#!/bin/bash -le
registry=$1
namespace=$2
for path in rails-base-image-ruby/*; do
image=$(echo $path| sed -re 's#/([^/]*)$#:\1#')
pushd $path
docker build -t $registry/$namespace/$image .
docker push $registry/$namespace/$image
@wshihadeh
wshihadeh / logrotate.conf
Created February 28, 2020 21:55
Log rotate
/var/lib/docker/containers/*/*.log {
copytruncate
compress
dateext
daily
dateformat -%Y%m%d%H%s
maxsize 350M
missingok
olddir /var/log/docker
sharedscripts
@wshihadeh
wshihadeh / logrotate.conf
Last active February 28, 2020 22:05
logrotate
/var/log/dockerlfs/*.log {
copytruncate
compress
dateext
size 20M
daily
dateformat -%Y%m%d%H%s
missingok
rotate 30
}