Browse Source

Improve standard build and install method

develop
Christian Aust 5 months ago
parent
commit
d553ec8cc6
  1. 11
      Dockerfile
  2. 16
      Gemfile.lock
  3. 1
      Rakefile

11
Dockerfile

@ -4,21 +4,22 @@ FROM ruby:2.7.2-alpine AS builder
WORKDIR /tmp
COPY . /tmp
# Build and install sanity gem into system gems
RUN apk --no-cache add build-base git && \
gem build sanity -o sanity.gem && \
gem install -N /tmp/sanity.gem
bundle config set deployment 'true' && \
bundle install && \
bundle exec rake install
# Create runtime image
FROM ruby:2.7.2-alpine AS runtime
LABEL MAINTAINERS="Christian Aust <christian.aust@zurich.com>"
VOLUME /app
WORKDIR /app
COPY --from=builder /usr/local/bundle /usr/local/bundle
RUN addgroup -S sanity && adduser -D -h /app -H -u 993 -G sanity sanity
USER sanity
VOLUME /app
WORKDIR /app
CMD ["/usr/local/bundle/bin/sanity", "/app/*.json"]

16
Gemfile.lock

@ -1,7 +1,7 @@
PATH
remote: .
specs:
sanity (1.1.4)
sanity (1.2.0)
colorize (~> 0.8.1)
dnsruby (~> 1.61.5)
dotenv (~> 2.7.6)
@ -26,7 +26,7 @@ GEM
domain_name (~> 0.5)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0225)
mime-types-data (3.2021.0704)
mini_portile2 (2.5.3)
netrc (0.11.0)
nokogiri (1.11.7)
@ -60,20 +60,20 @@ GEM
rspec-support (3.10.2)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.15.0)
rubocop (1.18.2)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.5.0, < 2.0)
rubocop-ast (>= 1.7.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.6.0)
rubocop-ast (1.7.0)
parser (>= 3.0.1.1)
rubocop-rake (0.5.1)
rubocop
rubocop-rspec (2.3.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.4.0)
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
ruby-progressbar (1.11.0)

1
Rakefile

@ -1,5 +1,6 @@
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

Loading…
Cancel
Save