Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker #12

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
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
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/
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM archlinux

MAINTAINER Alexander Popov <[email protected]>

ARG port

RUN pacman -Sy && pacman -S --noconfirm which git gcc make postgresql-libs

RUN useradd -m 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"]
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 @@ -6,7 +6,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