boxing 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +40 -0
- data/lib/boxing/version.rb +1 -1
- data/templates/Dockerfile.tt +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aa77750bf2c795fb7a6ec267784bbd62c352a9803729c7ba53e2f00e8536867
|
4
|
+
data.tar.gz: ec949c8362198e86a3c93b9c7b90da42697e666a2f98e517614e15dafe2234b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 883826c272959026f32ea98284def5e4908b96cf0866f3469bd934e464ffbe813a252b1fb29dc28c55c418e025c5ebf42c6b22cd21fa84da3d7687c2d72c0b11
|
7
|
+
data.tar.gz: 439823cf586f66dd4180570edbeda8089640c1ff80f7003524b8b34161c40d12ebaf7053dc432617fb3bf0db10844158c01484d17ccca127018b90bc27174603
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -16,6 +16,46 @@ And then execute:
|
|
16
16
|
|
17
17
|
$ bundle install
|
18
18
|
|
19
|
+
## Features
|
20
|
+
|
21
|
+
### Automatic Package Finder
|
22
|
+
|
23
|
+
This gem will read `Gemfile` and find any "knows" gem in the dependency database and put the necessary package as a dependency for build and runtime.
|
24
|
+
|
25
|
+
That means you never need to know the actual package and don't need to write your Dockerfile by hand.
|
26
|
+
|
27
|
+
### Optimized Size
|
28
|
+
|
29
|
+
By the default, the base image is depend on `ruby:[VERSION]-alpine` which is minimal size for Ruby in most cases.
|
30
|
+
|
31
|
+
To let your image as small as possible, this gem uses multi-stage and strip useless artifacts while the c-extension compiling.
|
32
|
+
|
33
|
+
The final Rails image will be around 100MB and can be flexible to delivery to any environment.
|
34
|
+
|
35
|
+
> We suggest using `puma` as the webserver to avoid the extra dependency to keep the image small.
|
36
|
+
|
37
|
+
### Revision
|
38
|
+
|
39
|
+
To identity your image version, the default build argument `REVISION` will be configured by default.
|
40
|
+
|
41
|
+
You can add extra options when you are building images in your CI.
|
42
|
+
|
43
|
+
```yaml
|
44
|
+
# GitLab CI example
|
45
|
+
docker:rails:
|
46
|
+
extends: .docker
|
47
|
+
stage: package
|
48
|
+
script:
|
49
|
+
- docker build
|
50
|
+
--cache-from $RAILS_IMAGE:latest
|
51
|
+
--build-arg REVISION=${CI_COMMIT_SHORT_SHA}
|
52
|
+
--build-arg BUILDKIT_INLINE_CACHE=1
|
53
|
+
--tag $RAILS_IMAGE:$CI_COMMIT_REF_SLUG
|
54
|
+
--tag $RAILS_IMAGE:latest .
|
55
|
+
```
|
56
|
+
|
57
|
+
It will helpful for Sentry to detect the released version or use `<%= ENV['REVISION'] %>` to help you identify the current version.
|
58
|
+
|
19
59
|
## Usage
|
20
60
|
|
21
61
|
### Generate
|
data/lib/boxing/version.rb
CHANGED
data/templates/Dockerfile.tt
CHANGED
@@ -29,6 +29,9 @@ ARG APP_ROOT
|
|
29
29
|
<%- if packages.select(&:runtime?).any? -%>
|
30
30
|
RUN apk add --no-cache <%= packages.select(&:runtime?).join(' ') %>
|
31
31
|
|
32
|
+
ARG REVISION
|
33
|
+
ENV REVISION $REVISION
|
34
|
+
|
32
35
|
<%- end -%>
|
33
36
|
COPY --from=gem /usr/local/bundle/config /usr/local/bundle/config
|
34
37
|
COPY --from=gem /usr/local/bundle /usr/local/bundle
|
@@ -43,6 +46,7 @@ ENV RAILS_LOG_TO_STDOUT=true
|
|
43
46
|
ENV APP_ROOT=$APP_ROOT
|
44
47
|
|
45
48
|
COPY . ${APP_ROOT}
|
49
|
+
RUN echo $REVISION > ${SERVER_ROOT}/REVISION
|
46
50
|
|
47
51
|
# Apply Execute Permission
|
48
52
|
RUN adduser -h ${APP_ROOT} -D -s /bin/nologin ruby ruby && \
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 蒼時弦也
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|