5 changed files with 46 additions and 37 deletions
Split View
Diff Options
-
14.dockerignore
-
57Dockerfile
-
2config/database.yml
-
4config/environments/production.rb
-
6config/storage.yml
@ -1,8 +1,20 @@ |
|||
.git |
|||
# OSX specific |
|||
.DS_Store |
|||
|
|||
# Ruby/Rails specific |
|||
.bundle |
|||
.ruby-* |
|||
node_modules |
|||
public/assets |
|||
storage/* |
|||
tmp |
|||
log/* |
|||
db/*.sqlite3 |
|||
|
|||
# other |
|||
.git |
|||
.gitignore |
|||
LICENSE |
|||
VERSION |
|||
README.md |
|||
docker-compose.yml |
@ -1,46 +1,39 @@ |
|||
FROM ruby:2.5.5-alpine |
|||
|
|||
# Set local timezone |
|||
RUN apk add --update tzdata && \ |
|||
cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime && \ |
|||
echo "Europe/Berlin" > /etc/timezone |
|||
|
|||
# Install your app's runtime dependencies in the container |
|||
RUN apk add --virtual runtime-deps nodejs libffi-dev readline sqlite sqlite-libs imagemagick |
|||
|
|||
# Do not install gem documentation |
|||
RUN echo 'gem: --no-ri --no-rdoc' > ~/.gemrc |
|||
RUN gem install bundler |
|||
|
|||
# Bundle into the temp directory |
|||
WORKDIR /tmp |
|||
ADD Gemfile* ./ |
|||
|
|||
# Install Yarn and others |
|||
ENV PATH=/root/.yarn/bin:$PATH |
|||
RUN apk add --virtual build-yarn curl && \ |
|||
touch ~/.bashrc && \ |
|||
curl -o- -L https://yarnpkg.com/install.sh | sh && \ |
|||
apk del build-yarn && \ |
|||
apk add --virtual build-deps build-base openssl-dev libc-dev linux-headers libxml2-dev libxslt-dev readline-dev sqlite-dev |
|||
|
|||
RUN bundle install --without development test && \ |
|||
apk del build-deps && \ |
|||
rm -rf /var/cache/apk/* |
|||
|
|||
# Configure production environment variables |
|||
ENV APP_HOME=/app \ |
|||
ENV PATH=/root/.yarn/bin:$PATH \ |
|||
APP_HOME=/app \ |
|||
RAILS_ENV=production \ |
|||
RACK_ENV=production |
|||
RACK_ENV=production \ |
|||
RAILS_LOG_TO_STDOUT=1 \ |
|||
RAILS_SERVE_STATIC_FILES=1 |
|||
|
|||
RUN apk add --update tzdata; \ |
|||
cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime; \ |
|||
echo "Europe/Berlin" > /etc/timezone; \ |
|||
echo "gem: --no-ri --no-rdoc" > ~/.gemrc; \ |
|||
gem install bundler; \ |
|||
apk add --virtual runtime-deps bash nodejs sqlite sqlite-libs imagemagick; \ |
|||
apk add --virtual build-yarn curl; \ |
|||
touch ~/.bashrc; \ |
|||
curl -o- -L https://yarnpkg.com/install.sh | sh; \ |
|||
apk del build-yarn; \ |
|||
apk add --virtual build-deps build-base libxml2-dev libxslt-dev sqlite-dev; \ |
|||
bundle install --without development test; \ |
|||
bundle clean; \ |
|||
apk del build-deps; \ |
|||
rm -rf /var/cache/apk/* |
|||
|
|||
# Copy the app's code into the container |
|||
COPY . $APP_HOME |
|||
WORKDIR $APP_HOME |
|||
|
|||
RUN bundle exec rake assets:precompile |
|||
RUN rake assets:precompile; \ |
|||
rm -Rf ./node_modules ./tmp/cache/* /tmp/* |
|||
|
|||
# Expose port 3000 from the container |
|||
VOLUME $APP_HOME/data |
|||
EXPOSE 3000 |
|||
|
|||
# Run puma server by default |
|||
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"] |
|||
CMD ["rails", "server", "-b", "0.0.0.0", "-e", "production"] |