-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix type streamServerClient.upsertUser lasdeloy to Vercel
- Loading branch information
Showing
33 changed files
with
860 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,48 @@ | ||
# syntax = docker/dockerfile:1 | ||
FROM ruby:3.3.3 | ||
|
||
# Install node & yarn | ||
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | ||
apt-get update && \ | ||
apt-get install -y \ | ||
libvips-dev \ | ||
nodejs \ | ||
curl && \ | ||
curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | ||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ | ||
apt-get update && \ | ||
apt-get install -y yarn | ||
|
||
# Install base deps or additional (e.g. tesseract) | ||
ARG INSTALL_DEPENDENCIES | ||
RUN apt-get update -qq \ | ||
&& apt-get install -y --no-install-recommends ${INSTALL_DEPENDENCIES} \ | ||
build-essential libpq-dev git \ | ||
&& apt-get clean autoclean \ | ||
&& apt-get autoremove -y \ | ||
&& rm -rf \ | ||
/var/lib/apt \ | ||
/var/lib/dpkg \ | ||
/var/lib/cache \ | ||
/var/lib/log | ||
|
||
# Install deps with bundler | ||
RUN mkdir /app | ||
WORKDIR /app | ||
COPY Gemfile* /app/ | ||
ARG BUNDLE_INSTALL_ARGS | ||
RUN gem install bundler:2.5.11 | ||
RUN bundle config set without 'development test' | ||
RUN bundle install ${BUNDLE_INSTALL_ARGS} \ | ||
&& rm -rf /usr/local/bundle/cache/* \ | ||
&& find /usr/local/bundle/gems/ -name "*.c" -delete \ | ||
&& find /usr/local/bundle/gems/ -name "*.o" -delete | ||
COPY . /app/ | ||
|
||
# Compile assets | ||
ARG RAILS_ENV=development | ||
RUN if [ "$RAILS_ENV" = "production" ]; then SECRET_KEY_BASE=$(rake secret) bundle exec rake assets:precompile; fi | ||
|
||
VOLUME /rails/db | ||
|
||
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile | ||
ARG RUBY_VERSION=3.3.2 | ||
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base | ||
|
||
# Rails app lives here | ||
WORKDIR /rails | ||
|
||
# Set production environment | ||
ENV RAILS_ENV="production" \ | ||
BUNDLE_DEPLOYMENT="1" \ | ||
BUNDLE_PATH="/usr/local/bundle" \ | ||
BUNDLE_WITHOUT="development" | ||
|
||
|
||
# Throw-away build stage to reduce size of final image | ||
FROM base as build | ||
|
||
# Install packages needed to build gems | ||
RUN apt-get update -qq && \ | ||
apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config | ||
|
||
# Install application gems | ||
COPY Gemfile Gemfile.lock ./ | ||
RUN bundle install && \ | ||
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ | ||
bundle exec bootsnap precompile --gemfile | ||
|
||
# Copy application code | ||
COPY . . | ||
|
||
# Precompile bootsnap code for faster boot times | ||
RUN bundle exec bootsnap precompile app/ lib/ | ||
|
||
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY | ||
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile | ||
|
||
|
||
# Final stage for app image | ||
FROM base | ||
|
||
# Install packages needed for deployment | ||
RUN apt-get update -qq && \ | ||
apt-get install --no-install-recommends -y curl libvips postgresql-client && \ | ||
rm -rf /var/lib/apt/lists /var/cache/apt/archives | ||
|
||
# Copy built artifacts: gems, application | ||
COPY --from=build /usr/local/bundle /usr/local/bundle | ||
COPY --from=build /rails /rails | ||
|
||
# Run and own only the runtime files as a non-root user for security | ||
RUN useradd rails --create-home --shell /bin/bash && \ | ||
chown -R rails:rails db log storage tmp | ||
USER rails:rails | ||
|
||
# Entrypoint prepares the database. | ||
ENTRYPOINT ["/rails/bin/docker-entrypoint"] | ||
|
||
# Start the server by default, this can be overwritten at runtime | ||
EXPOSE 3000 | ||
CMD ["./bin/rails", "server"] | ||
CMD ["rails", "server", "-b", "0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.