boxing 0.7.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b091fd5571f50dba6d62046e28c106088420a71c600f9a6727fc1404a84a2d19
4
- data.tar.gz: 575167c02a814facdbb558a7836c9e29f15c9f058e37cd71a0828fe011655840
3
+ metadata.gz: cc711842897fe99033eddd84096476da91f3e8978932f1b7e6ad81c92e58d6a8
4
+ data.tar.gz: aa5a956bdaefd0aad083eb1d953850692110c87ce1b7feebdd7a0bf9b1b0437b
5
5
  SHA512:
6
- metadata.gz: 282bfa9bfa4fa4da1e43987fc1ed902403a9de8ea74b4f3607f04855edab1557fcc2a791c4033dcc0dc072a87d341b4d519853315a64d5e8882e794199030b62
7
- data.tar.gz: 98d5df84a6455d92331ab48da7ebdd5d2aebacd2ba3cafac3b47e3e82fa7603477ab7f7a75507b0db51976ba3e970184b014097a49db7eacd404a91282c4945d
6
+ metadata.gz: 4ec68e4a79a4c7143c7cb5c627a066fcb358752e6d1a070f76da6ceda516ee4d3c684505bafeac107d3dd83b68bed3d24b4d44e9a489ce716a2832da89c3afea
7
+ data.tar.gz: afcafc86d6cd2bf263982da25245ba29eb97c9bc7957da8c2a3b01a72e03bef095c94060c565d79ace96cc62b0edec7e644315ea7128ceffc3791e6666751d86
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boxing (0.7.2)
4
+ boxing (0.9.0)
5
5
  bundler (~> 2.0)
6
6
  thor (~> 1.0)
7
7
 
data/README.md CHANGED
@@ -109,6 +109,24 @@ Boxing.config do |c|
109
109
  end
110
110
  ```
111
111
 
112
+ ### Revision Information
113
+
114
+ ```ruby
115
+ Boxing.config do |c|
116
+ c.revision = true
117
+ end
118
+ ```
119
+ > When building the image, you have to add `--build-arg REVISION=...` to set your revision name to compile it correctly.
120
+
121
+ ### Sentry Support
122
+
123
+ ```ruby
124
+ Boxing.config do |c|
125
+ c.sentry_release = true
126
+ end
127
+ ```
128
+ > When building the image, you have to add `--build-arg SENTRY_RELEASE=...` to set your release name to compile it correctly.
129
+
112
130
  ### Assets Precompile
113
131
 
114
132
  This feature is disabled by default and suggest to use CI to build it.
@@ -120,7 +138,6 @@ Boxing.config do |c|
120
138
  c.node_version = '14.18'
121
139
  end
122
140
  ```
123
-
124
141
  > When building the image, you have to add `--build-arg RAILS_MASTER_KEY=...` to set your production key to compile it correctly.
125
142
 
126
143
  ### Health Check
data/lib/boxing/config.rb CHANGED
@@ -12,12 +12,14 @@ module Boxing
12
12
  attr_accessor :root, :name, :registry, :ignores, :port,
13
13
  :health_check, :health_check_path,
14
14
  :assets_precompile, :node_version,
15
- :build_packages, :runtime_packages
15
+ :build_packages, :runtime_packages,
16
+ :revision, :sentry_release,
17
+ :entrypoint, :command
16
18
 
17
19
  # @since 0.5.0
18
20
  def initialize(&block)
19
21
  @name = 'myapp'
20
- @root = '/srv/app'
22
+ @root = '/src/app'
21
23
  @port = 9292
22
24
  @health_check_path = '/status'
23
25
  @assets_precompile = false
@@ -115,5 +115,31 @@ module Boxing
115
115
  mode |= Package::RUNTIME if config.runtime_packages&.include?(name)
116
116
  mode
117
117
  end
118
+
119
+ # Return entrypoint options
120
+ #
121
+ # @return [Array<String>]
122
+ #
123
+ # @since 0.9.0
124
+ def entrypoint
125
+ return config.entrypoint.map(&:to_s) if config.entrypoint
126
+ return ['bin/openbox'] if has?('openbox')
127
+ return ['bin/rails'] if has?('rails')
128
+
129
+ %w[bundle exec]
130
+ end
131
+
132
+ # Return command options
133
+ #
134
+ # @return [Array<String>]
135
+ #
136
+ # @since 0.9.0
137
+ def command
138
+ return config.command.map(&:to_s) if config.command
139
+ return ['server'] if has?('openbox')
140
+ return ['server', '-b', '0.0.0.0'] if has?('rails')
141
+
142
+ ['rackup', '-o', '0.0.0.0']
143
+ end
118
144
  end
119
145
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Boxing
4
- VERSION = '0.7.2'
4
+ VERSION = '0.9.0'
5
5
  end
@@ -2,7 +2,7 @@ ARG APP_ROOT=<%= config.root %>
2
2
  ARG RUBY_VERSION=<%= RUBY_VERSION %>
3
3
  <%- if config.assets_precompile -%>ARG NODE_VERSION=<%= node_version %><%- end -%>
4
4
 
5
- FROM ruby:${RUBY_VERSION}-alpine AS gem
5
+ FROM ruby:${RUBY_VERSION}-alpine AS base
6
6
  ARG APP_ROOT
7
7
 
8
8
  RUN apk add --no-cache <%= packages.select(&:build?).join(' ') %>
@@ -22,6 +22,10 @@ RUN gem install bundler:<%= Bundler::VERSION %> \
22
22
  && find ${APP_ROOT}/vendor/bundle -type f -name '*.o' -delete \
23
23
  && find ${APP_ROOT}/vendor/bundle -type f -name '*.gem' -delete
24
24
 
25
+ <%- if has?('bootsnap') -%>
26
+ RUN bundle exec bootsnap precompile --gemfile app/ lib/
27
+
28
+ <%- end -%>
25
29
  <%- if config.assets_precompile -%>
26
30
  FROM node:${NODE_VERSION}-alpine as node
27
31
  FROM ruby:${RUBY_VERSION}-alpine as assets
@@ -36,9 +40,9 @@ RUN apk add --no-cache <%= packages.select(&:runtime?).join(' ') %> yarn
36
40
  <%- end -%>
37
41
  COPY --from=node /usr/local/bin/node /usr/local/bin/node
38
42
 
39
- COPY --from=gem /usr/local/bundle/config /usr/local/bundle/config
40
- COPY --from=gem /usr/local/bundle /usr/local/bundle
41
- COPY --from=gem ${APP_ROOT}/vendor/bundle ${APP_ROOT}/vendor/bundle
43
+ COPY --from=base /usr/local/bundle/config /usr/local/bundle/config
44
+ COPY --from=base /usr/local/bundle /usr/local/bundle
45
+ COPY --from=base ${APP_ROOT}/vendor/bundle ${APP_ROOT}/vendor/bundle
42
46
 
43
47
  RUN mkdir -p ${APP_ROOT}
44
48
  COPY . ${APP_ROOT}
@@ -55,10 +59,13 @@ ARG APP_ROOT
55
59
  RUN apk add --no-cache <%= packages.select(&:runtime?).join(' ') %>
56
60
 
57
61
  <%- end -%>
58
- COPY --from=gem /usr/local/bundle/config /usr/local/bundle/config
59
- COPY --from=gem /usr/local/bundle /usr/local/bundle
60
- COPY --from=gem ${APP_ROOT}/vendor/bundle ${APP_ROOT}/vendor/bundle
62
+ COPY --from=base /usr/local/bundle/config /usr/local/bundle/config
63
+ COPY --from=base /usr/local/bundle /usr/local/bundle
64
+ COPY --from=base ${APP_ROOT}/vendor/bundle ${APP_ROOT}/vendor/bundle
65
+ <%- if has?('bootsnap') -%>
66
+ COPY --from=base ${APP_ROOT}/tmp/cache ${APP_ROOT}/tmp/cache
61
67
 
68
+ <%- end -%>
62
69
  RUN mkdir -p ${APP_ROOT}
63
70
 
64
71
  <%- if has?('rails') -%>
@@ -71,11 +78,18 @@ ENV APP_ROOT=$APP_ROOT
71
78
  COPY . ${APP_ROOT}
72
79
  <%- if config.assets_precompile -%>COPY --from=assets /${APP_ROOT}/public /${APP_ROOT}/public
73
80
  <%- end -%>
81
+ <%- if config.revision -%>
74
82
 
75
83
  ARG REVISION
76
84
  ENV REVISION $REVISION
77
85
  ENV COMMIT_SHORT_SHA $REVISION
78
86
  RUN echo "${REVISION}" > ${APP_ROOT}/REVISION
87
+ <%- end -%>
88
+ <%- if config.sentry_release -%>
89
+
90
+ ARG SENTRY_RELEASE
91
+ ENV SENTRY_RELEASE $SENTRY_RELEASE
92
+ <%- end -%>
79
93
 
80
94
  # Apply Execute Permission
81
95
  RUN adduser -h ${APP_ROOT} -D -s /bin/nologin ruby ruby && \
@@ -93,13 +107,5 @@ EXPOSE <%= config.port %>
93
107
  <%- if has?('liveness') || config.health_check -%>
94
108
  HEALTHCHECK CMD curl -f http://localhost:<%= config.port %><%= config.health_check_path %> || exit 1
95
109
  <%- end -%>
96
- <%- if has?('openbox') -%>
97
- ENTRYPOINT ["bin/openbox"]
98
- CMD ["server"]
99
- <%- elsif has?('rails') -%>
100
- ENTRYPOINT ["bin/rails"]
101
- CMD ["server", "-b", "0.0.0.0"]
102
- <%- else -%>
103
- ENTRYPOINT ["bundle", "exec"]
104
- CMD ["rackup", "-o", "0.0.0.0"]
105
- <%- end -%>
110
+ ENTRYPOINT <%= entrypoint %>
111
+ CMD <%= command %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 蒼時弦也
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-31 00:00:00.000000000 Z
11
+ date: 2022-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler