diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..f48d598b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +ARG RUBY_VERSION=3.2.2-alpine +FROM ruby:$RUBY_VERSION + +RUN apk add --update --no-cache \ + build-base \ + git \ + tzdata + +WORKDIR /app + +ENV RAILS_ENV="production" \ + BUNDLER_WITHOUT="development test" \ + RAILS_SERVE_STATIC_FILES="true" + +COPY Gemfile Gemfile.lock ./ + +RUN bundle install + +COPY . . + +# Precompile bootsnap code for faster boot times +RUN bundle exec bootsnap precompile --gemfile app/ lib/ + +# Precompiling assets for production without requiring secret RAILS_MASTER_KEY +RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile + +EXPOSE 3000 +CMD ["./bin/rails", "server"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..6312ef34 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3.6' + +services: + web: + build: . + ports: + - 3001:3000 + environment: + SECRET_KEY_BASE: 'e55fb68eb0f1f4f82fbb56eafeebf1c134518fd466d1c3d01b2bfd3d6b5cd9347b4c15eecb3bdc0e4c5bc226dba626a23bb7b9ddb14f709638571f910002f639' + RAILS_LOG_TO_STDOUT: 'true' + REMOTE_USER: blalbrit@stanford.edu + SETTINGS__CORS__ALLOW_ORIGIN_URL: 'http://localhost:3000' + tty: true \ No newline at end of file