Add tutorial files.

This commit is contained in:
2020-08-17 18:44:12 +01:00
parent ee8faa1e92
commit 521f0a2542
8 changed files with 75 additions and 1 deletions
+3
View File
@@ -65,3 +65,6 @@ yarn-debug.log*
# Ignore uploaded files in development
/storage/*
!/storage/.keep
# Ignore IJ IDE directory
.idea
+17
View File
@@ -0,0 +1,17 @@
FROM ruby:2.5
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
RUN mkdir /myapp
WORKDIR /myapp
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
COPY . /myapp
# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]
+2
View File
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'rails', '~>6'
+10
View File
@@ -0,0 +1,10 @@
GEM
specs:
PLATFORMS
x64-mingw32
DEPENDENCIES
BUNDLED WITH
1.17.2
+9 -1
View File
@@ -1,2 +1,10 @@
# docker-compose-rails-skel
Skeleton for the Docker ["Compose and Rails"](https://docs.docker.com/compose/rails/) tutorial
This project is a skeleton for a rails app following ["Quickstart: Compose and Rails"](https://docs.docker.com/compose/rails/)
From this sketch you can run the following commands to jump-start your app:
```
docker-compose run web rails new . --force --no-deps --database=postgresql
sudo chown -R $USER:$USER . # Linux only
docker-compose build
```
Now you should continue from ["Connect the database"](https://docs.docker.com/compose/rails/#connect-the-database) section of the tutorial
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUBY_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+17
View File
@@ -0,0 +1,17 @@
version: '3'
services:
db:
image: postgres
volumes:
- ./tmp/db:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: password
web:
build: .
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
volumes:
- .:/myapp
ports:
- "3000:3000"
depends_on:
- db
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
set -e
# Remove a potentially pre-existing server.pid for Rails.
rm -f /myapp/tmp/pids/server.pid
# Then exec the container's main process (what's set as CMD in the Dockerfile).
exec "$@"