-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.codebuild
More file actions
49 lines (36 loc) · 1.48 KB
/
Dockerfile.codebuild
File metadata and controls
49 lines (36 loc) · 1.48 KB
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
FROM ruby:2.7.2
RUN apt-get update -yqq
RUN apt-get install -yqq --no-install-recommends less vim postgresql-client rsync
# Install NodeJS, the default version for Debian 9 is NodeJS 4.8.x, which is not supported by Webpacker.
# RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -yqq nodejs
RUN npm install yarn -g
ENV RAILS_ENV production
# ENV BUNDLE_WITHOUT development:test
ENV RAILS_SERVE_STATIC_FILES true
ENV RAILS_LOG_TO_STDOUT true
ENV BUNDLER_VERSION=2.1.4
RUN gem install bundler -v 2.1.4
# COPY Gemfile* /usr/src/app/
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN bundle install --jobs=4
# TODO: Document the specific scenario why this is necessary
# See https://nickjanetakis.com/blog/dealing-with-lock-files-when-using-ruby-node-and-elixir-with-docker
# RUN mkdir -p /tmp/generated
# RUN cp Gemfile.lock /tmp/generated
# See https://nickjanetakis.com/blog/dealing-with-lock-files-when-using-ruby-node-and-elixir-with-docker
RUN mkdir -p /tmp/generated
RUN cp Gemfile.lock /tmp/generated
RUN cp yarn.lock /tmp/generated
# RUN cp -Rp node_modules /tmp/generated
RUN yarn install --production
# RUN bundle exec rake assets:precompile
# Make sure the generated files are owned by the original user so that when we copy them back,
# they will be synced back to the OS under the same user.
ARG uid=1000
ARG gid=1000
USER ${uid}:${gid}
USER root:root
ENTRYPOINT ["/usr/src/app/docker-container-entry.sh"]