Skip to content

Commit ae740d8

Browse files
committed
Add Docker
1 parent f87173d commit ae740d8

File tree

6 files changed

+95
-6
lines changed

6 files changed

+95
-6
lines changed

.dockerignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# temp
2+
.sass-cache/
3+
/log/
4+
/tmp/
5+
*.bak
6+
*~
7+
8+
# uploaded files
9+
#/public/files
10+
11+
# dumps
12+
/db/dumps/**/*
13+
14+
# seo files
15+
#/views/site/sitemap.html
16+
#/public/robots.txt
17+
18+
# node modules
19+
# /node_modules/
20+
21+
# compiled assets
22+
/public/styles/main.css
23+
/public/styles/main.css.map
24+
/public/scripts/compiled/

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@
3131
# node modules
3232
/node_modules/
3333

34+
# bundle
35+
/vendor/ruby/
36+
3437
# compiled assets
3538
/public/styles/main.css
3639
/public/styles/main.css.map
3740
/public/scripts/compiled/
41+
42+
# docker
43+
/db/docker/

Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM debian:latest
2+
3+
MAINTAINER Alexander Popov <[email protected]>
4+
5+
ARG port
6+
7+
RUN apt-get update -qq && apt-get install -y \
8+
## For `rbenv` and `nodenv`
9+
curl git gcc make \
10+
## For Ruby
11+
autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev \
12+
## For Ruby gems
13+
libpq-dev
14+
15+
RUN adduser --gecos '' --disabled-password stream_timer
16+
USER stream_timer
17+
ENV HOME /home/stream_timer
18+
19+
## Install `rbenv` and `ruby-build`
20+
ENV PATH $HOME/.rbenv/shims:$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH
21+
RUN curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash
22+
23+
## Install `nodenv` and `node-build`
24+
ENV PATH $HOME/.nodenv/shims:$HOME/.nodenv/bin:$HOME/.nodenv/plugins/node-build/bin:$PATH
25+
RUN curl -fsSL https://raw.githubusercontent.com/nodenv/nodenv-installer/master/bin/nodenv-installer | bash
26+
27+
ARG project_path=/home/stream_timer/stream_timer
28+
29+
RUN mkdir $project_path
30+
WORKDIR $project_path
31+
COPY --chown=stream_timer:stream_timer . $project_path
32+
33+
RUN exe/setup.sh
34+
35+
EXPOSE ${port}
36+
37+
CMD ["bundle", "exec", "toys", "server", "start"]

Gemfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@ GEM
6161
benchmark-ips (2.8.3)
6262
benchmark-memory (0.1.2)
6363
memory_profiler (~> 0.9)
64-
benchmark_toys (0.2.0)
64+
benchmark_toys (0.3.0)
6565
benchmark-ips (~> 2.8)
6666
benchmark-memory (~> 0.1.0)
67-
example_file (~> 0.1.0)
67+
example_file (~> 0.2.0)
6868
toys-core (~> 0.11.0)
6969
bundler-audit (0.7.0.1)
7070
bundler (>= 1.2.0, < 3)
7171
thor (>= 0.18, < 2)
7272
byebug (11.1.3)
7373
clamp (1.3.2)
7474
coderay (1.1.3)
75-
config_toys (0.2.0)
76-
example_file (~> 0.1.0)
75+
config_toys (0.3.0)
76+
example_file (~> 0.2.0)
7777
toys-core (~> 0.11.0)
7878
content_disposition (1.0.0)
7979
diff-lcs (1.4.4)
@@ -85,7 +85,7 @@ GEM
8585
netaddr (>= 2.0.4, < 3)
8686
simpleidn
8787
erubi (1.9.0)
88-
example_file (0.1.0)
88+
example_file (0.2.0)
8989
diffy (~> 3.0)
9090
highline (~> 2.0)
9191
paint (~> 2.0)

docker-compose.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: '3'
2+
services:
3+
db:
4+
image: postgres
5+
volumes:
6+
- ./db/docker:/var/lib/postgresql/data
7+
environment:
8+
POSTGRES_DB: 'stream_timer'
9+
POSTGRES_USER: 'stream_timer'
10+
POSTGRES_PASSWORD: 'K1MWcvPouuaaDlssN1vk'
11+
web:
12+
image: stream_timer
13+
build:
14+
context: .
15+
args:
16+
port: 3000
17+
volumes:
18+
- .:/home/stream_timer/stream_timer
19+
ports:
20+
- "3000:3000"
21+
depends_on:
22+
- db

exe/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CURRENT_DIR=`dirname "$0"`
99

1010
exe $CURRENT_DIR/setup/ruby.sh
1111

12-
exe toys config check
12+
exe bundle exec toys config check
1313
# exe toys db create
1414
# exe toys db migrate
1515

0 commit comments

Comments
 (0)