Skip to content
Draft
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
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ignore docker-compose
docker-compose.yml

# Ignore git metadata
.git

# Ignore .dockerignore
.dockerignore
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
# Ignore application configuration
/config/application.yml

# Ignore docker-compose
docker-compose.yml

.DS_Store

.env
.env
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM ruby:2.7.2

WORKDIR /usr/src/app

RUN apt-get update
RUN apt-get install nodejs -y

RUN gem install bundler foreman

COPY Gemfile Gemfile.lock /usr/src/app/

RUN bundle install

COPY . /usr/src/app/

ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
42 changes: 42 additions & 0 deletions docker-compose.yml.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: "3"

services:
postgres:
image: postgres:12
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: plylst_password
POSTGRES_USER: plylst
POSTGRES_DB: plylst_production

redis:
image: redis
restart: unless-stopped
volumes:
- redis-data:/var/lib/redis

plylst:
build: .
restart: unless-stopped
expose:
- 5000
depends_on:
- postgres
- redis
environment:
# https://developer.spotify.com/dashboard/applications
spotify_key:
spotify_secret:
RAILS_ENV: production
RAILS_SERVE_STATIC_FILES: 1
# Use `openssl rand -hex 64` to generate a random key
SECRET_KEY_BASE:
REDIS_URL: redis://redis:6379/1
PLYLST_DATABASE_PASSWORD: plylst_password
DATABASE_URL: postgres://plylst:plylst_password@postgres/plylst_production

volumes:
postgres-data:
redis-data:
10 changes: 10 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# Prepare database
bin/rails db:prepare

# Precompile assets
bin/rails assets:precompile

# Starts webserver and background jobs
foreman start