mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-26 17:51:47 +08:00
Build bundle dependencies in separate docker volume [SCI-1199]
This commit is contained in:
parent
c57589781c
commit
cb22aa47ba
4 changed files with 40 additions and 36 deletions
17
Dockerfile
17
Dockerfile
|
@ -9,29 +9,18 @@ RUN apt-get update -qq && \
|
|||
default-jre-headless \
|
||||
unison \
|
||||
sudo graphviz --no-install-recommends \
|
||||
sudo libfile-mimeinfo-perl && \
|
||||
libfile-mimeinfo-perl && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# heroku tools
|
||||
RUN wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh
|
||||
|
||||
# install gems
|
||||
COPY Gemfile* /tmp/
|
||||
COPY addons /tmp/addons
|
||||
WORKDIR /tmp
|
||||
RUN bundle install
|
||||
RUN rm -rf addons
|
||||
ENV BUNDLE_PATH /usr/src/bundle
|
||||
RUN mkdir $BUNDLE_PATH
|
||||
|
||||
# create app directory
|
||||
ENV APP_HOME /usr/src/app
|
||||
RUN mkdir $APP_HOME
|
||||
WORKDIR $APP_HOME
|
||||
RUN mkdir addons
|
||||
RUN ln -s $(readlink -f addons) /tmp
|
||||
|
||||
# container user
|
||||
RUN groupadd scinote
|
||||
RUN useradd -ms /bin/bash -g scinote scinote
|
||||
USER scinote
|
||||
|
||||
CMD rails s -b 0.0.0.0
|
||||
|
|
|
@ -9,13 +9,15 @@ RUN apt-get update -qq && \
|
|||
netcat \
|
||||
default-jre-headless \
|
||||
sudo graphviz --no-install-recommends \
|
||||
sudo libfile-mimeinfo-perl && \
|
||||
libfile-mimeinfo-perl && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# install gems
|
||||
COPY Gemfile* /tmp/
|
||||
COPY addons /tmp/addons
|
||||
WORKDIR /tmp
|
||||
RUN bundle install
|
||||
RUN rm -rf addons
|
||||
|
||||
# create app directory
|
||||
ENV APP_HOME /usr/src/app
|
||||
|
|
2
Makefile
2
Makefile
|
@ -53,7 +53,7 @@ rails-production:
|
|||
run:
|
||||
rm tmp/pids/server.pid || true
|
||||
@docker-compose up -d
|
||||
@docker attach $(shell docker-compose ps web | grep "rails s" | awk '{ print $$1; }')
|
||||
@docker attach scinote_web_development
|
||||
|
||||
start:
|
||||
@docker-compose start
|
||||
|
|
|
@ -1,22 +1,35 @@
|
|||
version: '2.1'
|
||||
services:
|
||||
db:
|
||||
container_name: scinote_db_development
|
||||
image: postgres:9.4
|
||||
volumes:
|
||||
- scinote_development_postgres:/var/lib/postgresql/data
|
||||
|
||||
dbdata:
|
||||
image: busybox
|
||||
volumes:
|
||||
- /var/lib/postgresql
|
||||
command: "true"
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: scinote_web_development
|
||||
container_name: scinote_web_development
|
||||
stdin_open: true
|
||||
tty: true
|
||||
depends_on:
|
||||
- db
|
||||
ports:
|
||||
- "3000:3000"
|
||||
command: >
|
||||
bash -c "rm -f /usr/src/app/tmp/pids/server.pid &&
|
||||
(bundle check || bundle install) &&
|
||||
bundle exec rails s -b 0.0.0.0"
|
||||
environment:
|
||||
- RAILS_ENV=development
|
||||
volumes:
|
||||
- .:/usr/src/app
|
||||
- scinote_development_bundler:/usr/src/bundle
|
||||
- scinote_development_files:/usr/src/app/public/system
|
||||
|
||||
db:
|
||||
image: postgres:9.4
|
||||
volumes_from:
|
||||
- dbdata
|
||||
|
||||
web:
|
||||
build: .
|
||||
stdin_open: true
|
||||
tty: true
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- .:/usr/src/app
|
||||
links:
|
||||
- db
|
||||
volumes:
|
||||
scinote_development_postgres:
|
||||
scinote_development_bundler:
|
||||
scinote_development_files:
|
||||
|
|
Loading…
Reference in a new issue