Skip to content

Commit

Permalink
Merge pull request #383 from amd-9/feature/add_docker_support
Browse files Browse the repository at this point in the history
Feature/add docker support
  • Loading branch information
Malcom1986 committed Oct 24, 2022
2 parents f8cee44 + fda8ce7 commit 4c265cf
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ yarn-debug.log*
doc
.env

# Ignore docker and docker-compose files
docker-compose.yml

# Ignore coverage files
/coverage
.tool-versions
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ruby:3.1.2

WORKDIR /usr/src/app/

COPY . .

RUN apt update && apt install -y nodejs npm && npm install --global yarn

RUN make setup

RUN bin/rake db:migrate

CMD "bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}"

2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include make-compose.mk

test:
bin/rails test

Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3.7'

services:
app:
build: .
volumes:
- .:/usr/src/app/
ports:
- "3000:3000"
env_file:
- ".env"
command: "bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}"
webpacker:
build: .
environment:
- WEBPACKER_DEV_SERVER_HOST=0.0.0.0
command: ./bin/webpack-dev-server
volumes:
- .:/usr/src/app/
ports:
- '3035:3035'
30 changes: 30 additions & 0 deletions make-compose.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
compose:
docker-compose up -d

compose-build:
docker-compose build

compose-logs:
docker-compose logs -f

compose-down:
docker-compose down || true

compose-clear:
docker-compose down -v --remove-orphans || true

compose-stop:
docker-compose stop || true

compose-restart:
docker-compose restart

compose-test:
docker-compose run --rm app make fixtures-load && make test

compose-lint:
docker-compose run --rm app make lint

compose-lint-fix:
docker-compose run --rm app make linter-code-fix

0 comments on commit 4c265cf

Please sign in to comment.