Update to a more usable Docker format
This commit is contained in:
parent
04b3a618dd
commit
2780abd944
14 changed files with 120 additions and 45 deletions
|
@ -3,4 +3,7 @@
|
|||
!Gemfile.lock
|
||||
!package.json
|
||||
!package-lock.json
|
||||
!script/debian_setup.sh
|
||||
!script/build/debian/*.sh
|
||||
!Rakefile
|
||||
!config/*
|
||||
!db/*
|
22
Dockerfile
22
Dockerfile
|
@ -1,22 +0,0 @@
|
|||
FROM ruby:2.3
|
||||
ARG USER
|
||||
RUN mkdir /myapp
|
||||
COPY Gemfile /myapp/Gemfile
|
||||
COPY Gemfile.lock /myapp/Gemfile.lock
|
||||
COPY package.json /myapp/package.json
|
||||
COPY package-lock.json /myapp/package-lock.json
|
||||
COPY script/debian_setup.sh /myapp/script/debian_setup.sh
|
||||
WORKDIR /myapp
|
||||
RUN script/debian_setup.sh
|
||||
RUN groupadd -r -g 1000 $USER
|
||||
RUN useradd -r -m -g $USER -u 1000 $USER
|
||||
RUN chown -R $USER /usr/local/bundle
|
||||
RUN chgrp -R $USER /usr/local/bundle
|
||||
RUN chown -R $USER /myapp
|
||||
RUN chgrp -R $USER /myapp
|
||||
RUN chown -R $USER /usr/lib/node_modules
|
||||
RUN chgrp -R $USER /usr/lib/node_modules
|
||||
USER $USER
|
||||
RUN bundle install
|
||||
EXPOSE 5000
|
||||
CMD foreman start
|
|
@ -56,6 +56,7 @@ You will likely need to logout and log back in again.
|
|||
#### Build your docker-container and start it up for initial set up.
|
||||
We'll keep this running in the console we'll call **console 1**
|
||||
```
|
||||
cd docker/debug
|
||||
docker-compose build
|
||||
docker-compose up
|
||||
```
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails/all'
|
|||
|
||||
Bundler.require *Rails.groups(:assets) if defined?(Bundler)
|
||||
|
||||
require File.expand_path('lib/htp') # Hamster Table Print
|
||||
#require File.expand_path('lib/htp') # Hamster Table Print
|
||||
|
||||
module Commitchange
|
||||
class Application < Rails::Application
|
||||
|
|
16
docker/build/Dockerfile
Normal file
16
docker/build/Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
|||
FROM ruby:2.3.7-stretch
|
||||
ARG USER
|
||||
RUN mkdir /myapp
|
||||
COPY script/build/debian/prebuild.sh myapp/script/build/debian/prebuild.sh
|
||||
RUN myapp/script/build/debian/prebuild.sh
|
||||
COPY script/build/debian/node.sh myapp/script/build/debian/node.sh
|
||||
RUN myapp/script/build/debian/node.sh
|
||||
COPY script/build/debian/postgres.sh myapp/script/build/debian/postgres.sh
|
||||
RUN myapp/script/build/debian/postgres.sh
|
||||
COPY script/build/debian/java.sh myapp/script/build/debian/java.sh
|
||||
RUN myapp/script/build/debian/java.sh
|
||||
WORKDIR /myapp
|
||||
COPY Gemfile /myapp/Gemfile
|
||||
COPY Gemfile.lock /myapp/Gemfile.lock
|
||||
RUN bundle install
|
||||
CMD rake db:create db:structure:load test:prepare && rake spec && npx jest && npm run build-all
|
23
docker/build/docker-compose.yml
Normal file
23
docker/build/docker-compose.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
# License: CC0-1.0
|
||||
version: '2'
|
||||
services:
|
||||
build:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: docker/build/Dockerfile
|
||||
depends_on:
|
||||
- db
|
||||
- memcached
|
||||
environment:
|
||||
- DATABASE_HOST=db
|
||||
- MEMCACHE_SERVERS=memcached
|
||||
volumes:
|
||||
- ../../:/myapp
|
||||
db:
|
||||
image: postgres:9.6
|
||||
environment:
|
||||
POSTGRES_USER: "admin"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
memcached:
|
||||
image: memcached
|
||||
|
28
docker/debug/Dockerfile
Normal file
28
docker/debug/Dockerfile
Normal file
|
@ -0,0 +1,28 @@
|
|||
FROM ruby:2.3.7-stretch
|
||||
ARG USER
|
||||
RUN mkdir /myapp
|
||||
COPY script/build/debian/prebuild.sh myapp/script/build/debian/prebuild.sh
|
||||
RUN myapp/script/build/debian/prebuild.sh
|
||||
COPY script/build/debian/node.sh myapp/script/build/debian/node.sh
|
||||
RUN myapp/script/build/debian/node.sh
|
||||
COPY script/build/debian/postgres.sh myapp/script/build/debian/postgres.sh
|
||||
RUN myapp/script/build/debian/postgres.sh
|
||||
COPY script/build/debian/java.sh myapp/script/build/debian/java.sh
|
||||
RUN myapp/script/build/debian/java.sh
|
||||
WORKDIR /myapp
|
||||
RUN groupadd -r -g 1000 $USER
|
||||
RUN useradd -r -m -g $USER -u 1000 $USER
|
||||
RUN chown -R $USER /usr/local/bundle
|
||||
RUN chgrp -R $USER /usr/local/bundle
|
||||
RUN chown -R $USER /myapp
|
||||
RUN chgrp -R $USER /myapp
|
||||
RUN chown -R $USER /usr/lib/node_modules
|
||||
RUN chgrp -R $USER /usr/lib/node_modules
|
||||
COPY Gemfile /myapp/Gemfile
|
||||
COPY Gemfile.lock /myapp/Gemfile.lock
|
||||
RUN bundle install
|
||||
RUN chown -R $USER /myapp/Gemfile
|
||||
RUN chgrp -R $USER /myapp/Gemfile.lock
|
||||
USER $USER
|
||||
EXPOSE 5000
|
||||
CMD foreman start
|
|
@ -1,29 +1,37 @@
|
|||
# License: CC0-1.0
|
||||
version: '2'
|
||||
services:
|
||||
db:
|
||||
image: postgres:9.6
|
||||
environment:
|
||||
POSTGRES_USER: "admin"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
volumes:
|
||||
- ./postgres-data:/var/lib/postgresql/data
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
context: ../..
|
||||
dockerfile: docker/debug/Dockerfile
|
||||
args:
|
||||
- USER
|
||||
user: ${USER}
|
||||
|
||||
environment:
|
||||
- DATABASE_HOST=db
|
||||
- MEMCACHE_SERVERS=memcached
|
||||
- USER=${USER}
|
||||
|
||||
volumes:
|
||||
- .:/myapp
|
||||
- ../../:/myapp
|
||||
|
||||
ports:
|
||||
- "5000:5000"
|
||||
depends_on:
|
||||
- db
|
||||
- memcached
|
||||
user: ${USER}
|
||||
db:
|
||||
image: postgres:9.6
|
||||
environment:
|
||||
- USER=${USER}
|
||||
- DATABASE_HOST=db
|
||||
- MEMCACHE_SERVERS=memcached
|
||||
POSTGRES_USER: "admin"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
memcached:
|
||||
image: memcached
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
2
run
2
run
|
@ -1,2 +1,2 @@
|
|||
#!/usr/bin/env bash
|
||||
docker-compose run web $@
|
||||
docker-compose -f docker/debug/docker-compose.yml run web $@
|
||||
|
|
4
script/build/debian/java.sh
Executable file
4
script/build/debian/java.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
apt-get -yy install default-jre
|
6
script/build/debian/node.sh
Executable file
6
script/build/debian/node.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
curl -sL https://deb.nodesource.com/setup_9.x | bash -
|
||||
apt-get update -qq && apt-get install -y nodejs
|
||||
npm install npm@^6 -g
|
4
script/build/debian/postgres.sh
Executable file
4
script/build/debian/postgres.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
apt-get -yy install libpq5=9.6.10-0+deb9u1 libpq-dev=9.6.10-0+deb9u1 postgresql=9.6+181+deb9u1
|
4
script/build/debian/prebuild.sh
Executable file
4
script/build/debian/prebuild.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
apt-get update -qq && apt-get install -y build-essential
|
|
@ -2,7 +2,7 @@
|
|||
set -e
|
||||
|
||||
curl -sL https://deb.nodesource.com/setup_9.x | bash -
|
||||
echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' > /etc/apt/sources.list.d/pgdg.list
|
||||
|
||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||
apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs postgresql-9.6 default-jre
|
||||
npm install npm@^6 -g
|
Loading…
Reference in a new issue