-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
Copy pathDockerfile
56 lines (47 loc) · 1.53 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
56
#
# Base layer that both dev and runtime inherit from.
#
FROM ruby:3.3.2-alpine as devdocs-base
ENV LANG=C.UTF-8
ARG USERNAME=devdocs
ARG USER_ID=1000
ARG GROUP_ID=1000
WORKDIR /devdocs
EXPOSE 9292
COPY Gemfile Gemfile.lock Rakefile Thorfile /devdocs/
RUN apk --update add nodejs build-base libstdc++ gzip git zlib-dev libcurl oxipng && \
rm -rf /var/cache/apk/* /usr/lib/node_modules
RUN gem install bundler && \
bundle config set path.system true && \
bundle config set without test && \
bundle install && \
rm -rf ~/.gem /root/.bundle/cache /usr/local/bundle/cache
RUN addgroup -g $GROUP_ID $USERNAME && \
adduser -u $USER_ID -G $USERNAME -D -h /devdocs $USERNAME && \
chown -R $USERNAME:$USERNAME /devdocs
#
# Development Image
#
FROM devdocs-base as devdocs-dev
RUN bundle config unset without && \
bundle install && \
apk add --update bash curl && \
curl -LO https://download.docker.com/linux/static/stable/x86_64/docker-26.1.4.tgz && \
tar -xzf docker-26.1.4.tgz && \
mv docker/docker /usr/bin && \
rm -rf docker docker-26.1.4.tgz && \
rm -rf ~/.gem /root/.bundle/cache /usr/local/bundle/cache
VOLUME [ "/devdocs", "/devdocs/public/docs", "/devdocs/public/assets" ]
CMD bash
#
# Runtime Image
#
FROM devdocs-base as devdocs
ENV ENABLE_SERVICE_WORKER=true
COPY . /devdocs/
RUN apk del gzip build-base git zlib-dev && \
chown -R $USERNAME:$USERNAME /devdocs && \
rm -rf /tmp
VOLUME [ "/devdocs/public/docs", "/devdocs/public/assets" ]
USER $USERNAME
CMD rackup --host 0.0.0.0 -E production