Skip to content

Instantly share code, notes, and snippets.

@Yardboy
Created April 26, 2020 01:11
Show Gist options
  • Save Yardboy/48f31a255723f8489cebec4c783b858f to your computer and use it in GitHub Desktop.
Save Yardboy/48f31a255723f8489cebec4c783b858f to your computer and use it in GitHub Desktop.
dockerfile
FROM ruby:2.6.5
LABEL app-name="shards"
RUN apt-get update -qq && apt-get install -y \
nodejs \
curl \
vim
# Create and set the working directory
ENV APP_HOME /app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
# Add RAILS/RACK/NODE ENV vars for env dependent tasks
ARG RAILS_ENV
ENV RAILS_ENV $RAILS_ENV
ARG RACK_ENV
ENV RACK_ENV $RACK_ENV
ARG NODE_ENV
ENV NODE_ENV $NODE_ENV
# Install Yarn and update PATH for executable
ENV YARN_VERSION=1.22.4
RUN curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
ENV PATH="/root/.yarn/bin:${PATH}"
# Install ruby dependencies
ENV BUNDLE_PATH /bundle
ADD Gemfile* $APP_HOME/
RUN bundle config --global silence_root_warning 1
RUN bundle install
# Install node dependencies
ADD package.json yarn.lock $APP_HOME/
RUN yarn install --force
# COPY app to container
COPY . $APP_HOME
# Expose puma port
EXPOSE 3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment