diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5735e81 --- /dev/null +++ b/.dockerignore @@ -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/ diff --git a/.gitignore b/.gitignore index c016020..bf5196a 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..86418ef --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM archlinux + +MAINTAINER Alexander Popov + +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"] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..cd8cae4 --- /dev/null +++ b/docker-compose.yaml @@ -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 diff --git a/exe/setup.sh b/exe/setup.sh index 0a9a2f3..c1b1ef9 100755 --- a/exe/setup.sh +++ b/exe/setup.sh @@ -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