Added db:migrate and DATABASE variable
This commit is contained in:
@@ -27,9 +27,8 @@ RUN gem install bundler && bundle install
|
||||
|
||||
VOLUME /app/db/database
|
||||
|
||||
RUN bin/rake assets:precompile
|
||||
RUN bundle exec rake assets:precompile
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT ["bundle", "exec"]
|
||||
CMD ["rails", "server", "-b", "0.0.0.0"]
|
||||
CMD cd /app && rake 'db:migrate' && bundle exec rails server -b 0.0.0.0
|
||||
|
||||
@@ -25,10 +25,6 @@ docker run -d --name snibox \
|
||||
snibox
|
||||
```
|
||||
|
||||
After first run you probably will see error due to database hasn't been initialized in the attached volume. Pleas run following command to create empty database:
|
||||
Default database file location is `/app/db/database/snibox.sqlite3`, however you can redefine it by using environment variable `DATABASE`.
|
||||
|
||||
```bash
|
||||
docker exec <container_id> /app/bin/rails db:migrate
|
||||
```
|
||||
|
||||
This will create new database instance and Snibox is ready to go.
|
||||
Container is running `rake db:migrate` on every start, in order to either create database if not exist, or update database scheme if required, so backups are highly recommended.
|
||||
@@ -2,4 +2,4 @@ development:
|
||||
adapter: sqlite3
|
||||
pool: 5
|
||||
timeout: 5000
|
||||
database: db/database/snibox.sqlite3
|
||||
database: <%= ENV['DATABASE'] || "db/database/snibox.sqlite3" %>
|
||||
|
||||
Reference in New Issue
Block a user