-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (38 loc) · 1.01 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
##### Setup for Alpine #####
FROM ruby:3.3-alpine3.19 AS builder
ENV LANG=C.UTF-8
ENV WORKDIR="/app/"
WORKDIR ${WORKDIR}
RUN apk add --no-cache \
linux-headers \
build-base \
gcc \
"rust=1.76.0-r0" \
cargo
##### Ruby Gem Management #####
FROM builder AS gembuilder
ARG bundler_jobs=2
ENV WORKDIR="/app/"
WORKDIR ${WORKDIR}
COPY Gemfile* ${WORKDIR}
RUN bundle config set without 'development test'
RUN bundle install -j${bundler_jobs}
##### MAIN CONTAINER #####
FROM ruby:3.3-alpine
RUN apk add nodejs npm \
&& rm -rf /var/cache/apk/*; \
npm install -g prettier;
ENV LANG=C.UTF-8
ENV RUBY_YJIT_ENABLE=1
ENV NODEJS_VERSION=22
ENV RACK_ENV=production
# replace labradorite with your username on your server
ARG USERNAME=labradorite
RUN adduser -D ${USERNAME}
USER ${USERNAME}
ENV WORKDIR=/home/${USERNAME}
WORKDIR /home/${USERNAME}
EXPOSE 9292
COPY --from=gembuilder /usr/local/bundle/ /usr/local/bundle/
COPY --chown=${USERNAME} . ${WORKDIR}
CMD ["bundle", "exec rackup -o0 -Eproduction"]