forked from ifmeorg/ifme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
40 lines (34 loc) · 1.03 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
# Dockerfile
FROM ruby:2.3
ENV PORT 3000
ENV PATH /node_modules/.bin:$PATH
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get update -qq \
&& apt-get install -y \
build-essential \
libpq-dev \
nodejs \
&& npm install --global yarn \
&& groupadd --system ifme \
&& useradd \
--create-home \
--gid ifme \
--home-dir /home/ifme \
--no-log-init \
--system \
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}