File tree 4 files changed +77
-37
lines changed
4 files changed +77
-37
lines changed Original file line number Diff line number Diff line change
1
+ # .dockerignore
2
+ .github /
3
+ .idea /
4
+ examples /
5
+ README.md
6
+ LICENSE
7
+ .git /
8
+ * .md
9
+ * .yml
10
+ Dockerfile
Original file line number Diff line number Diff line change 1
- FROM ruby:3.0.5
1
+ # The first stage is dedicated to building the application
2
+ FROM ruby:3.2.2-alpine as BUILD
2
3
3
- MAINTAINER James Hu <
[email protected] >
4
-
5
- ENV PORT 9594
6
- ENV ROOT /srv
7
- RUN mkdir -p $ROOT
4
+ ENV PORT=9594 \
5
+ USER=app \
6
+ GROUP=appgroup \
7
+ ROOT=/srv
8
8
9
9
WORKDIR $ROOT
10
10
11
- COPY Gemfile $ROOT
12
- COPY Gemfile.lock $ROOT
11
+ # Updating system packages and installing dependencies
12
+ RUN apk update && apk upgrade && \
13
+ apk add --update --no-cache --virtual .build-deps \
14
+ build-base \
15
+ libffi-dev \
16
+ ruby-dev
17
+
18
+ # Copy the Gemfile and Gemfile.lock
19
+ COPY Gemfile Gemfile.lock $ROOT/
20
+
21
+ # Run the specific version of bundle to install all the necessary libraries
22
+ RUN gem install bundler && \
23
+ bundle install && \
24
+ apk del .build-deps && \
25
+ rm -rf /usr/local/bundle/cache/*.gem && \
26
+ find /usr/local/bundle/gems/ -name "*.c" -delete && \
27
+ find /usr/local/bundle/gems/ -name "*.o" -delete
28
+
29
+ COPY . $ROOT/
13
30
14
- RUN bundle install
31
+ # The second stage is responsible for preparing the runtime
32
+ FROM ruby:3.2.2-alpine as RUNTIME
33
+
34
+ # Copy over files from the BUILD step
35
+ COPY --from=BUILD $ROOT $ROOT
36
+
37
+ # Set environmental variables
38
+ ENV PORT=9594 \
39
+ USER=app \
40
+ GROUP=appgroup \
41
+ ROOT=/srv
42
+
43
+ WORKDIR $ROOT
15
44
16
- COPY . $ROOT
45
+ RUN addgroup -S $GROUP && \
46
+ adduser -S $USER -G $GROUP && \
47
+ chown -R $USER:$GROUP $ROOT && \
48
+ chmod 755 config.ru
17
49
18
- RUN chmod +x config.ru
50
+ USER $USER:$GROUP
19
51
20
- CMD bundle exec puma --port $PORT
52
+ CMD bundle exec puma -b tcp://0.0.0.0: $PORT
Original file line number Diff line number Diff line change 1
1
source "https://rubygems.org"
2
2
git_source ( :github ) { |repo | "https://github.com/#{ repo } .git" }
3
3
4
- ruby "3.0.5 "
4
+ ruby "3.2.2 "
5
5
6
- gem "http" , "5.1.0 "
7
- gem "prometheus-client" , "4.0.0 "
8
- gem "puma" , "6.0 .0"
9
- gem "rack" , "3.0.1 "
6
+ gem "http" , "~> 5.1.1 "
7
+ gem "prometheus-client" , "~> 4.2.2 "
8
+ gem "puma" , "~> 6.4 .0"
9
+ gem "rack" , "~> 3.0.8 "
Original file line number Diff line number Diff line change 1
1
GEM
2
2
remote: https://rubygems.org/
3
3
specs:
4
- addressable (2.8.1 )
4
+ addressable (2.8.6 )
5
5
public_suffix (>= 2.0.2 , < 6.0 )
6
- domain_name (0.5.20190701 )
7
- unf ( >= 0.0.5 , < 1.0.0 )
8
- ffi (1.15.5 )
6
+ domain_name (0.6.20231109 )
7
+ ffi ( 1.16.3 )
8
+ ffi (1.16.3-x64-mingw-ucrt )
9
9
ffi-compiler (1.0.1 )
10
10
ffi (>= 1.0.0 )
11
11
rake
12
- http (5.1.0 )
12
+ http (5.1.1 )
13
13
addressable (~> 2.8 )
14
14
http-cookie (~> 1.0 )
15
15
http-form_data (~> 2.2 )
20
20
llhttp-ffi (0.4.0 )
21
21
ffi-compiler (~> 1.0 )
22
22
rake (~> 13.0 )
23
- nio4r (2.5.8 )
24
- prometheus-client (4.0.0 )
25
- public_suffix (5.0.0 )
26
- puma (6.0 .0 )
23
+ nio4r (2.7.0 )
24
+ prometheus-client (4.2.2 )
25
+ public_suffix (5.0.4 )
26
+ puma (6.4 .0 )
27
27
nio4r (~> 2.0 )
28
- rack (3.0.1 )
29
- rake (13.0.6 )
30
- unf (0.1.4 )
31
- unf_ext
32
- unf_ext (0.0.8.2 )
28
+ rack (3.0.8 )
29
+ rake (13.1.0 )
33
30
34
31
PLATFORMS
35
32
aarch64-linux
36
33
arm64-darwin-21
34
+ x64-mingw-ucrt
37
35
38
36
DEPENDENCIES
39
- http ( = 5.1.0 )
40
- prometheus-client ( = 4.0.0 )
41
- puma ( = 6.0.0 )
42
- rack ( = 3.0.1 )
37
+ http
38
+ prometheus-client
39
+ puma
40
+ rack
43
41
44
42
RUBY VERSION
45
- ruby 3.0.5p211
43
+ ruby 3.2.2p53
46
44
47
45
BUNDLED WITH
48
- 2.2.33
46
+ 2.5.3
You can’t perform that action at this time.
0 commit comments