forked from ifmeorg/ifme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (34 loc) · 962 Bytes
/
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
# Dockerfile
FROM ruby:2.6-alpine
ENV PORT 3000
ENV PATH /node_modules/.bin:$PATH
RUN apk update \
&& apk add \
nodejs \
curl \
npm \
build-base \
postgresql-dev \
tzdata \
&& npm install --global yarn \
&& addgroup --system ifme \
&& adduser \
-G ifme \
-h /home/ifme \
-S \
ifme \
&& mkdir -p "/app" "/node_modules" \
&& chown ifme:ifme "/app" "/node_modules" \
# install node modules outside of /app
&& echo "--install.modules-folder /node_modules" > /.yarnrc
WORKDIR /app
USER ifme:ifme
# add gems and npm packages before our code, so Docker can cache them
# see http://ilikestuffblog.com/2014/01/06/
COPY --chown=ifme:ifme Gemfile Gemfile.lock package.json ./
COPY --chown=ifme:ifme client/package.json client/yarn.lock ./client/
RUN bundle install && npm install
COPY --chown=ifme:ifme . ./
RUN bundle exec rake assets:precompile
CMD ["foreman", "start", "-f", "Procfile.dev"]
EXPOSE ${PORT}