Skip to content

Commit

Permalink
Add Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWayfer committed Oct 1, 2020
1 parent f87173d commit ae740d8
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 6 deletions.
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# temp
.sass-cache/
/log/
/tmp/
*.bak
*~

# uploaded files
#/public/files

# dumps
/db/dumps/**/*

# seo files
#/views/site/sitemap.html
#/public/robots.txt

# node modules
# /node_modules/

# compiled assets
/public/styles/main.css
/public/styles/main.css.map
/public/scripts/compiled/
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@
# node modules
/node_modules/

# bundle
/vendor/ruby/

# compiled assets
/public/styles/main.css
/public/styles/main.css.map
/public/scripts/compiled/

# docker
/db/docker/
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM debian:latest

MAINTAINER Alexander Popov <[email protected]>

ARG port

RUN apt-get update -qq && apt-get install -y \
## For `rbenv` and `nodenv`
curl git gcc make \
## For Ruby
autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev \
## For Ruby gems
libpq-dev

RUN adduser --gecos '' --disabled-password stream_timer
USER stream_timer
ENV HOME /home/stream_timer

## Install `rbenv` and `ruby-build`
ENV PATH $HOME/.rbenv/shims:$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH
RUN curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash

## Install `nodenv` and `node-build`
ENV PATH $HOME/.nodenv/shims:$HOME/.nodenv/bin:$HOME/.nodenv/plugins/node-build/bin:$PATH
RUN curl -fsSL https://raw.githubusercontent.com/nodenv/nodenv-installer/master/bin/nodenv-installer | bash

ARG project_path=/home/stream_timer/stream_timer

RUN mkdir $project_path
WORKDIR $project_path
COPY --chown=stream_timer:stream_timer . $project_path

RUN exe/setup.sh

EXPOSE ${port}

CMD ["bundle", "exec", "toys", "server", "start"]
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ GEM
benchmark-ips (2.8.3)
benchmark-memory (0.1.2)
memory_profiler (~> 0.9)
benchmark_toys (0.2.0)
benchmark_toys (0.3.0)
benchmark-ips (~> 2.8)
benchmark-memory (~> 0.1.0)
example_file (~> 0.1.0)
example_file (~> 0.2.0)
toys-core (~> 0.11.0)
bundler-audit (0.7.0.1)
bundler (>= 1.2.0, < 3)
thor (>= 0.18, < 2)
byebug (11.1.3)
clamp (1.3.2)
coderay (1.1.3)
config_toys (0.2.0)
example_file (~> 0.1.0)
config_toys (0.3.0)
example_file (~> 0.2.0)
toys-core (~> 0.11.0)
content_disposition (1.0.0)
diff-lcs (1.4.4)
Expand All @@ -85,7 +85,7 @@ GEM
netaddr (>= 2.0.4, < 3)
simpleidn
erubi (1.9.0)
example_file (0.1.0)
example_file (0.2.0)
diffy (~> 3.0)
highline (~> 2.0)
paint (~> 2.0)
Expand Down
22 changes: 22 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3'
services:
db:
image: postgres
volumes:
- ./db/docker:/var/lib/postgresql/data
environment:
POSTGRES_DB: 'stream_timer'
POSTGRES_USER: 'stream_timer'
POSTGRES_PASSWORD: 'K1MWcvPouuaaDlssN1vk'
web:
image: stream_timer
build:
context: .
args:
port: 3000
volumes:
- .:/home/stream_timer/stream_timer
ports:
- "3000:3000"
depends_on:
- db
2 changes: 1 addition & 1 deletion exe/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CURRENT_DIR=`dirname "$0"`

exe $CURRENT_DIR/setup/ruby.sh

exe toys config check
exe bundle exec toys config check
# exe toys db create
# exe toys db migrate

Expand Down

0 comments on commit ae740d8

Please sign in to comment.