forked from o19s/quepid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.prod
72 lines (60 loc) · 2.37 KB
/
Dockerfile.prod
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
FROM node:16-buster AS build-dep
WORKDIR /srv/app
COPY package.json yarn.lock ./
RUN yarn install --production=true
FROM ruby:2.7.6-buster
LABEL maintainer="[email protected]"
# Must have packages
# The next line is a list of dependencies if we move to slim-buster, however it only shaves 80MB off the image.
# mariadb-server libmariadbclient-dev mariadb-client mysql-common ruby-mysql2 libmariadbd-dev build-essential patch ruby-dev zlib1g-dev liblzma-dev gnupg
RUN apt-get update -qq && apt-get install -y --no-install-recommends vim curl apt-transport-https ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Node and Yarn
RUN wget --no-check-certificate -qO - 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 curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
nodejs \
yarn \
ca-certificates \
bzip2 \
libfontconfig \
&& apt-get clean all \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies
WORKDIR /srv/app
COPY Gemfile Gemfile.lock ./
RUN gem install bundler:2.3.18
# Clean up Bundle
RUN bundle config set without 'development test'
RUN bundle install && \
bundle clean --force && \
rm -rf /app/.bundle/cache && \
rm -rf /app/vendor/bundle/ruby/*/cache
COPY --from=build-dep /srv/app/node_modules ./node_modules/
#COPY . .
COPY ./app ./app
COPY ./app.json ./app.json
COPY ./babel.config.js ./babel.config.js
COPY ./bin ./bin
COPY ./config ./config
COPY ./config.ru ./config.ru
COPY ./db ./db
COPY ./Gemfile ./Gemfile
COPY ./Gemfile.lock ./Gemfile.lock
COPY ./lib ./lib
COPY ./LICENSE ./LICENSE
COPY ./package.json ./package.json
COPY ./postcss.config.js ./postcss.config.js
COPY ./Procfile ./Procfile
COPY ./public ./public
COPY ./Rakefile ./Rakefile
COPY ./README.md ./README.md
COPY ./vendor ./vendor
COPY ./yarn.lock ./yarn.lock
RUN mkdir -p tmp/pids
RUN RAILS_ENV=production SECRET_KEY_BASE=fake_out_devise bundle exec rake assets:precompile
# Remove some files not needed in resulting image
RUN rm package.json yarn.lock
CMD ["foreman", "s", "-f", "Procfile"]