add docker
This commit is contained in:
parent
23bb0bca0d
commit
b9bde40edc
21
Dockerfile
Normal file
21
Dockerfile
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
FROM ruby:2.7.1
|
||||||
|
|
||||||
|
LABEL maintainer="Radin <radin@instedd.org>"
|
||||||
|
|
||||||
|
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
||||||
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
|
||||||
|
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
|
||||||
|
apt-get update -qq && \
|
||||||
|
apt-get install -y vim nodejs sqlite3 libsqlite3-dev yarn && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
RUN mkdir /app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY Gemfile* package.json yarn.lock /app/
|
||||||
|
|
||||||
|
RUN gem install bundler -v 2.1.4 && \
|
||||||
|
bundle install --jobs 20
|
||||||
|
|
||||||
|
COPY . /app
|
|
@ -5,7 +5,7 @@
|
||||||
#
|
#
|
||||||
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
||||||
# Character.create(name: 'Luke', movie: movies.first)
|
# Character.create(name: 'Luke', movie: movies.first)
|
||||||
if Rails.env.development?
|
unless AdminUser.find_by(email: 'bijan@example.com')
|
||||||
AdminUser.create!(email: 'admin@example.com', password: 'password', password_confirmation: 'password')
|
|
||||||
AdminUser.create!(email: 'bijan@example.com', password: '1234567890', password_confirmation: '1234567890')
|
AdminUser.create!(email: 'bijan@example.com', password: '1234567890', password_confirmation: '1234567890')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
31
docker-compose.yml
Normal file
31
docker-compose.yml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
bundle:
|
||||||
|
db:
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: nouchka/sqlite3:latest
|
||||||
|
volumes:
|
||||||
|
- db:/root/db
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
|
||||||
|
web: &rails
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rake db:create db:migrate db:seed && bundle exec rails s -b '0.0.0.0'"
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
- bundle:/usr/local/bundle
|
||||||
|
- ./node_modules:/app/node_modules
|
||||||
|
tmpfs: /app/tmp
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
env_file: app.env
|
||||||
|
tty: true
|
||||||
|
stdin_open: true
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
Loading…
Reference in New Issue
Block a user