58 lines
1.5 KiB
Docker
58 lines
1.5 KiB
Docker
FROM ruby:3.3.3
|
|
|
|
# Variables for
|
|
|
|
WORKDIR /app
|
|
|
|
# Install nodejs
|
|
ENV NVM_DIR /usr/local/nvm
|
|
ENV NODE_VERSION 20.15.1
|
|
|
|
RUN mkdir -p $NVM_DIR
|
|
|
|
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
|
|
&& . $NVM_DIR/nvm.sh \
|
|
&& nvm install ${NODE_VERSION} \
|
|
&& nvm alias default ${NODE_VERSION} \
|
|
&& nvm use default
|
|
|
|
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
|
|
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
|
|
|
|
RUN corepack enable
|
|
|
|
# Install dependencies for Rails
|
|
COPY Gemfile Gemfile.lock ./
|
|
RUN bundle install
|
|
|
|
#COPY package.json yarn.lock ./
|
|
COPY . .
|
|
RUN yarn install
|
|
|
|
# Setup default configuration
|
|
COPY config/database.yml.docker config/database.yml
|
|
COPY config/secrets.yml.docker config/secrets.yml
|
|
COPY config/action_mailer.yml.example config/action_mailer.yml
|
|
COPY config/code_ocean.yml.docker config/code_ocean.yml
|
|
COPY config/content_security_policy.yml.example config/content_security_policy.yml
|
|
COPY config/docker.yml.erb.example config/docker.yml.erb
|
|
COPY config/mnemosyne.yml.example config/mnemosyne.yml
|
|
|
|
# get a secret from `rails secret`
|
|
RUN secret_key_base=$(bundle exec rails secret) \
|
|
&& sed -i "s/secret_key_base: CHANGE_ME/secret_key_base: $secret_key_base/" config/secrets.yml
|
|
|
|
# precompile
|
|
ENV RAILS_SERVE_STATIC_FILES=true
|
|
RUN bundle exec rake assets:precompile
|
|
RUN yarn run webpack
|
|
|
|
COPY entrypoint.sh /usr/bin/
|
|
RUN chmod +x /usr/bin/entrypoint.sh
|
|
ENTRYPOINT ["entrypoint.sh"]
|
|
|
|
EXPOSE 7000
|
|
|
|
# run on HOSTNAME:PORT
|
|
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
|