Add tutorial files.
This commit is contained in:
@@ -65,3 +65,6 @@ yarn-debug.log*
|
||||
# Ignore uploaded files in development
|
||||
/storage/*
|
||||
!/storage/.keep
|
||||
|
||||
# Ignore IJ IDE directory
|
||||
.idea
|
||||
+17
@@ -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"]
|
||||
@@ -0,0 +1,10 @@
|
||||
GEM
|
||||
specs:
|
||||
|
||||
PLATFORMS
|
||||
x64-mingw32
|
||||
|
||||
DEPENDENCIES
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.2
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
@@ -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
|
||||
@@ -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 "$@"
|
||||
Reference in New Issue
Block a user