build: 🔨 Docker setup
Dockerfile, docker-compose and entrypoint
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
.vscode
|
||||||
|
README.md
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
RAILS_ENV=development
|
||||||
|
HOST=0.0.0.0
|
||||||
|
PORT=3000
|
||||||
|
|
||||||
|
DATABASE_NAME=url_shortener
|
||||||
|
DATABASE_USER=user
|
||||||
|
DATABASE_PASSWORD=user_12345
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
||||||
|
#
|
||||||
|
# If you find yourself ignoring temporary files generated by your text editor
|
||||||
|
# or operating system, you probably want to add a global ignore instead:
|
||||||
|
# git config --global core.excludesfile '~/.gitignore_global'
|
||||||
|
|
||||||
|
# Ignore bundler config.
|
||||||
|
/.bundle
|
||||||
|
|
||||||
|
# Ignore all logfiles and tempfiles.
|
||||||
|
/log/*
|
||||||
|
/tmp/*
|
||||||
|
!/log/.keep
|
||||||
|
!/tmp/.keep
|
||||||
|
|
||||||
|
# Ignore uploaded files in development
|
||||||
|
/storage/*
|
||||||
|
!/storage/.keep
|
||||||
|
|
||||||
|
/node_modules
|
||||||
|
/yarn-error.log
|
||||||
|
|
||||||
|
/public/assets
|
||||||
|
.byebug_history
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
FROM ruby:2.6.6-alpine
|
||||||
|
|
||||||
|
ENV APP_PATH /usr/src/app
|
||||||
|
ENV BUNDLE_VERSION 2.1.4
|
||||||
|
ENV BUNDLE_PATH /usr/local/bundle/gems
|
||||||
|
ENV RAILS_LOG_TO_STDOUT true
|
||||||
|
ENV RAILS_PORT 3000
|
||||||
|
|
||||||
|
WORKDIR $APP_PATH
|
||||||
|
|
||||||
|
EXPOSE $RAILS_PORT
|
||||||
|
|
||||||
|
RUN apk -U add --no-cache \
|
||||||
|
build-base \
|
||||||
|
postgresql-dev \
|
||||||
|
postgresql-client \
|
||||||
|
tzdata \
|
||||||
|
yarn
|
||||||
|
|
||||||
|
COPY ./entrypoint.dev.sh /usr/bin/entrypoint.sh
|
||||||
|
RUN chmod +x /usr/bin/entrypoint.sh
|
||||||
|
|
||||||
|
RUN gem install bundler --version "$BUNDLE_VERSION"
|
||||||
|
RUN gem install rubocop
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
ENTRYPOINT ["entrypoint.sh"]
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres:12.5-alpine
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: user
|
||||||
|
POSTGRES_PASSWORD: user_12345
|
||||||
|
POSTGRES_DB: url_shortener
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile.dev
|
||||||
|
volumes:
|
||||||
|
- .:/usr/src/app
|
||||||
|
- gem_cache:/usr/local/bundle/gems
|
||||||
|
command: bundle exec rails s -p 3000 -b '0.0.0.0'
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
env_file: .env.dev
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
gem_cache:
|
||||||
|
db_data:
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
echo "Environment: $RAILS_ENV"
|
||||||
|
|
||||||
|
bundle check || bundle install --jobs 20 --retry 5
|
||||||
|
|
||||||
|
rm -f $APP_PATH/tmp/pids/server.pid
|
||||||
|
|
||||||
|
${@}
|
||||||
Reference in New Issue
Block a user