Skip to content

Commit

Permalink
Version 1.0
Browse files Browse the repository at this point in the history
V1.0
  • Loading branch information
Whiletruedoend authored Feb 1, 2023
2 parents 7e1aff4 + ed6b0c2 commit 08ffafb
Show file tree
Hide file tree
Showing 111 changed files with 3,303 additions and 2,777 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git/
.idea/
.tmp/
*.Dockerfile
README.md
README-RU.md
Twilight.drawio
update_log.md
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ENV=development
PORT=3080
POSTGRES_HOST="192.168.160.2"
POSTGRES_PORT=5432
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=pass
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.vscode
.idea
/config/credentials.yml
/db/schema.rb

# Ignore bundler config.
/.bundle
Expand Down Expand Up @@ -44,3 +45,5 @@
yarn-debug.log*
.yarn-integrity
config/database.yml
Gemfile.lock
.env
79 changes: 79 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Start from a small, trusted base image with the version pinned down
FROM ruby:2.7.7-slim AS base

# Required Libraries
#RUN apt-get update; apt-get install -y --no-install-recommends \
# build-essential ubuntu-dev-tools apt-utils bison openssl \
# libreadline6-dev curl git-core zlib1g \
# zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf \
# libc6-dev ncurses-dev automake libtool
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
build-essential sudo gnupg2 git libvips curl

# Yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

RUN apt-get update; apt-get install -y --no-install-recommends \
tzdata libv8-dev imagemagick libmagickwand-dev \
libpq-dev libffi-dev \
postgresql-client sqlite3 \
#postgresql postgresql-contrib sqlite3 \
nodejs redis yarn

# This stage will be responsible for installing gems and npm packages
FROM base AS dependencies

COPY Gemfile Gemfile.lock ./

# Install gems (excluding test dependencies)
RUN bundle config set without "test" && \
bundle install --jobs=3 --retry=3

COPY package.json yarn.lock ./

# NodeJS & yarn install
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
RUN . ~/.nvm/nvm.sh && nvm install node 19.5.0 && \
nvm use 19.5.0 && nvm alias default 19.5.0 && \
yarn install --frozen-lockfile

# We're back at the base stage
FROM base

# Create a non-root user to run the app and own app-specific files
RUN adduser app

# Switch to this user
USER app

# We'll install the app in this directory
WORKDIR /home/app

# Copy over gems from the dependencies stage
COPY --from=dependencies /usr/local/bundle/ /usr/local/bundle/

# Copy over npm packages from the dependencies stage
# Note that we have to use `--chown` here
COPY --chown=app --from=dependencies /node_modules/ node_modules/

# Finally, copy over the code
# This is where the .dockerignore file comes into play
# Note that we have to use `--chown` here
COPY --chown=app . ./

# Install assets
#RUN RAILS_ENV=production bundle exec rake assets:precompile

# Listen port
EXPOSE ${PORT}

# Launch the server
#CMD rails server -b 0.0.0.0 -P /tmp/server.pid

# Ensure binding is always 0.0.0.0, even in development, to access server from outside container
#ENV BINDING="0.0.0.0"

# Overwrite ruby image's entrypoint to provide open cli
#ENTRYPOINT [""]
CMD ["rails", "s", "-b", "0.0.0.0"]
20 changes: 13 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,29 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.0'
ruby '2.7.7'

gem 'activerecord', '>= 6.1.2.1'
gem 'activerecord', '>= 6.1.7.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '>= 6.1.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '>= 1.4'
# Use Puma as the app server
gem 'puma', '>= 5.0'
gem 'puma', '>= 5.6.4'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacke
gem 'webpacker', '>= 5.4.2'
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem 'importmap-rails'
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem 'turbo-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '>= 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '>= 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'actionpack', '>= 6.1.4.1'
Expand Down Expand Up @@ -49,7 +53,6 @@ group :development do
gem 'listen', '~> 3.3'
gem 'rack-mini-profiler', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'colorize'
gem 'spring'
end

Expand All @@ -64,6 +67,8 @@ end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

gem 'colorize'

# rubocop
gem 'code-scanning-rubocop'
gem 'panolint'
Expand All @@ -79,17 +84,18 @@ gem 'dry-initializer-rails'
gem 'easy_captcha', github: 'kopylovvlad/easy_captcha'
gem 'enumerize'
gem 'grape'
gem 'image_processing'
gem 'image_processing', '>= 1.12.2'
gem 'mini_magick'
gem 'nokogiri', '>= 1.11.0.rc4'
gem 'open-uri'
gem 'pg'
gem 'redcarpet'
gem 'reverse_markdown'
gem 'rmagick'
gem 'rmagick', '~> 4.1.1'
gem 'rollbar'
gem 'rubyzip'
gem 'simple_command'
gem 'socksify', require: false # TCP through a SOCKS5 proxy
gem 'telegram-bot'

gem 'sidekiq'
Expand Down
Loading

0 comments on commit 08ffafb

Please sign in to comment.