mirror of https://github.com/codevalet/canary
Properly build Puma, and other native gems, inside the container
This doesn't end up as big as I feared, so I'm rather pleased. Fixes #3
This commit is contained in:
parent
9e8a768e11
commit
ce0ba7e520
11
Dockerfile
11
Dockerfile
|
@ -1,13 +1,12 @@
|
|||
FROM ruby:2.3-alpine
|
||||
|
||||
ARG BUILD_PKGS="ruby-dev openssl-dev gcc make libc-dev binutils"
|
||||
ARG APP_DIR=/webapp
|
||||
|
||||
RUN mkdir -p ${APP_DIR}/vendor
|
||||
|
||||
WORKDIR ${APP_DIR}
|
||||
|
||||
ADD vendor/ ${APP_DIR}/vendor/
|
||||
|
||||
ENV GEM_HOME=${APP_DIR}/vendor/gems
|
||||
ENV BUNDLE_PATH=${APP_DIR}/vendor/gems
|
||||
ENV BUNDLE_APP_CONFIG=${APP_DIR}/vendor/gems/.bundle
|
||||
|
@ -18,4 +17,10 @@ ADD app/ ${APP_DIR}/app/
|
|||
ADD config.ru ${APP_DIR}/
|
||||
ADD views ${APP_DIR}/views/
|
||||
ADD assets ${APP_DIR}/assets/
|
||||
CMD bundle exec rackup -o 0.0.0.0
|
||||
|
||||
RUN apk add -U ${BUILD_PKGS} && \
|
||||
bundle install && \
|
||||
apk del ${BUILD_PKGS} && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
CMD bundle exec puma
|
||||
|
|
5
Gemfile
5
Gemfile
|
@ -1,10 +1,11 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'haml'
|
||||
gem 'sinatra'
|
||||
gem 'httparty'
|
||||
gem 'puma'
|
||||
gem 'sentry-raven'
|
||||
gem 'sentry-api'
|
||||
gem 'httparty'
|
||||
gem 'sinatra'
|
||||
|
||||
group :test do
|
||||
gem 'rspec'
|
||||
|
|
|
@ -17,6 +17,7 @@ GEM
|
|||
multi_xml (0.6.0)
|
||||
multipart-post (2.0.0)
|
||||
mustermann (1.0.1)
|
||||
puma (3.10.0)
|
||||
rack (2.0.3)
|
||||
rack-protection (2.0.0)
|
||||
rack
|
||||
|
@ -51,6 +52,7 @@ PLATFORMS
|
|||
DEPENDENCIES
|
||||
haml
|
||||
httparty
|
||||
puma
|
||||
rspec
|
||||
sentry-api
|
||||
sentry-raven
|
||||
|
|
11
Makefile
11
Makefile
|
@ -1,16 +1,19 @@
|
|||
|
||||
all: check container
|
||||
|
||||
check: depends spec
|
||||
check: spec check-container
|
||||
|
||||
spec:
|
||||
spec: depends
|
||||
./scripts/ruby bundle exec rspec -c
|
||||
|
||||
depends: Gemfile
|
||||
./scripts/ruby bundle install
|
||||
|
||||
run: depends
|
||||
./scripts/ruby bundle exec rackup -o 0.0.0.0
|
||||
./scripts/ruby bundle exec puma
|
||||
|
||||
check-container: container
|
||||
docker run --rm rtyler/codevalet-canary:latest bundle exec puma --version
|
||||
|
||||
container: depends Dockerfile
|
||||
docker build -t rtyler/codevalet-canary .
|
||||
|
@ -18,4 +21,4 @@ container: depends Dockerfile
|
|||
clean:
|
||||
rm -rf vendor
|
||||
|
||||
.PHONY: all depends clean run check container spec
|
||||
.PHONY: all depends clean run check container spec check-container
|
||||
|
|
Loading…
Reference in New Issue