Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions serverside_challenge_2/challenge/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# flyctl launch added from .gitignore
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
.bundle

# Ignore all logfiles and tempfiles.
log\*
tmp\*
!log\.keep
!tmp\.keep

# Ignore pidfiles, but keep the directory.
tmp\pids\*
!tmp\pids
!tmp\pids\.keep

# Ignore uploaded files in development.
storage\*
!storage\.keep
tmp\storage\*
!tmp\storage
!tmp\storage\.keep

# Ignore master key for decrypting credentials and more.
config\master.key
fly.toml
1 change: 1 addition & 0 deletions serverside_challenge_2/challenge/.rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
71 changes: 65 additions & 6 deletions serverside_challenge_2/challenge/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,67 @@
# ベースイメージ
FROM ruby:3.1.2
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs vim
RUN mkdir /app

# 必要パッケージ
RUN apt-get update -qq && apt-get install -y \
build-essential \
libpq-dev \
nodejs \
postgresql-client \
vim \
&& rm -rf /var/lib/apt/lists/*

# 作業ディレクトリ
WORKDIR /app
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install
ADD . /app

# Gemfile を先にコピーして bundle install(キャッシュ活用)
COPY Gemfile* ./
RUN bundle install --jobs 4 --retry 3

# アプリ全体コピー
COPY . .

# PID ファイル削除してサーバー起動
#CMD ["sh", "-c", "rm -f tmp/pids/server.pid && RAILS_ENV=production bin/rails server -b 0.0.0.0 -p 8080"]
CMD ["bin/rails", "server", "-b", "0.0.0.0", "-p", "3000"]


#FROM ruby:3.1.2
#RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs vim postgresql-client
#RUN mkdir /app
#WORKDIR /app
#ADD Gemfile /app/Gemfile
#ADD Gemfile.lock /app/Gemfile.lock
#RUN bundle install
#ADD . /app
## Gemfile
#COPY Gemfile* ./
#RUN bundle install
## アプリコードコピー
#COPY . .
## デフォルトコマンド(Fly.io が起動時に使用)
#CMD ["bin/rails", "server", "-b", "0.0.0.0", "-p", "8080"]


#FROM ruby:3.1.2
#RUN apt-get update -qq && apt-get install -y \
# build-essential \
# libpq-dev \
# nodejs \
# yarn \
# vim
#
## 作業ディレクトリ
#WORKDIR /app
## bundler を最新化(bundle not found 防止)
#RUN gem install bundler
## Gemfile を先にコピーして bundle install
#COPY Gemfile Gemfile.lock ./
#RUN bundle install
## アプリ全体をコピー
#COPY . .
## ポートを公開
#EXPOSE 3000
#ENV RAILS_ENV=production
#ENV RACK_ENV=production
## Rails サーバーを起動
#CMD ["bin/rails", "server", "-b", "0.0.0.0", "-p", "3000"]
2 changes: 2 additions & 0 deletions serverside_challenge_2/challenge/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ gem "bootsnap", require: false
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem "rack-cors"

gem "rails-html-sanitizer"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri mingw x64_mingw ]
Expand Down
Loading