-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
53 lines (41 loc) · 1.1 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
###
### MAIN TARGET
###
ARG MRI_VERSION
FROM ruby:${MRI_VERSION} as api
LABEL maintainer=blambeau@enspirit.be
ENV LANG C.UTF-8
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update -qq \
&& apt-get install -qq --no-install-recommends \
curl \
vim \
libsasl2-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Add user
RUN addgroup --gid 1000 --system app \
&& adduser --uid 1000 --system --gid 1000 app \
&& mkdir -p /home/app \
&& chown app:app -R /home/app
# Set correct environment variables and workdir
ENV HOME /home/app
WORKDIR /home/app
USER app
CMD bundle exec puma -p 3000
###
### WEB TARGET
###
FROM api as web
USER root
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update -qq \
&& apt-get install -qq --no-install-recommends \
nodejs \
yarn \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
USER app
CMD bundle exec puma -p 3000