parsley/Dockerfile

51 lines
1.4 KiB
Docker
Raw Normal View History

2018-04-02 11:21:35 -05:00
FROM phusion/passenger-ruby24:latest
2016-07-07 17:47:47 -05:00
2016-01-18 20:50:19 -06:00
# Use baseimage-docker's init process.
CMD ["/sbin/my_init"]
2018-03-30 14:31:09 -05:00
# Install Node
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install -y --no-install-recommends nodejs yarn && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN gem update --system && gem install bundler
2016-01-18 20:50:19 -06:00
# Enable Nginx / Passenger
RUN rm -f /etc/service/nginx/down
# Install nginx config files
RUN rm /etc/nginx/sites-enabled/default
ADD docker/nginx_server.conf /etc/nginx/sites-enabled/parsley.conf
ADD docker/nginx_env.conf /etc/nginx/main.d/env.conf
2016-01-19 17:26:23 -06:00
# Add DB Migration Script
RUN mkdir -p /etc/my_init.d
ADD docker/db_migrate.sh /etc/my_init.d/db_migrate.sh
RUN chmod +x /etc/my_init.d/db_migrate.sh
2016-01-18 20:50:19 -06:00
# Set Default RAILS_ENV
ENV RAILS_ENV docker
2016-01-18 20:50:19 -06:00
ENV PASSENGER_APP_ENV docker
# Setup directory and install gems
2018-03-30 14:31:09 -05:00
RUN mkdir -p /home/app/parsley/log /home/app/parsley/tmp
RUN chown -R app:app /home/app/parsley/
2016-01-18 20:50:19 -06:00
WORKDIR /home/app/parsley/
2018-03-30 14:31:09 -05:00
COPY Gemfile* ./
RUN bundle install --deployment --jobs 4 --without development test
COPY package.json yarn.lock ./
RUN yarn install --production=true
# Copy the app into the image
COPY --chown="app" . .
2016-01-18 20:50:19 -06:00
# Compile assets
2018-03-30 14:31:09 -05:00
RUN su app -c "bundle exec rails webpacker:clobber webpacker:compile"
2016-01-18 20:50:19 -06:00