-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify docker, shrink production image size! (#409)
* lets not load keycloak into our docker image * cleanups on Docker * tweak * Fix the case of the missing tmp/pids, slight optimization to dev dockerfile * simplify gem setup, older racc works native with our Ruby 2x * trying buster not slim-buster again * lint * this change drops us to 1.48 GB Co-authored-by: [email protected] <> Co-authored-by: Daniel Worley <[email protected]>
- Loading branch information
Showing
7 changed files
with
48 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,6 @@ Dockerfile* | |
.github | ||
.circleci/**/* | ||
.circleci | ||
|
||
# Keycloak config files (not used by Quepid) | ||
keycloak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,6 @@ FROM ruby:2.7.4-buster | |
|
||
LABEL maintainer="[email protected]" | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
ENV home . | ||
|
||
# Must have packages | ||
|
@@ -24,16 +22,13 @@ RUN apt-get update -qq \ | |
|
||
# may not need libgbm | ||
|
||
|
||
# Install Node | ||
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash | ||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | ||
# Node and Yarn | ||
RUN curl -sL 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_15.x | bash - | ||
RUN apt-get update -qq && apt-get install -y --no-install-recommends nodejs yarn netcat \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY . /srv/app/ | ||
|
||
# Clean environment | ||
RUN apt-get clean all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:14.17.3-buster AS build-dep | ||
FROM node:15.14.0-buster AS build-dep | ||
WORKDIR /srv/app | ||
COPY package.json yarn.lock ./ | ||
RUN yarn install --production=true | ||
|
@@ -7,16 +7,16 @@ FROM ruby:2.7.4-buster | |
|
||
LABEL maintainer="[email protected]" | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
# Must have packages | ||
RUN apt-get update -qq && apt-get install -y --no-install-recommends vim curl git tmux apt-transport-https ca-certificates \ | ||
# 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/* | ||
|
||
# Install Node | ||
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash | ||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | ||
# Node and Yarn | ||
RUN curl -sL 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_15.x | bash - | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
|
@@ -32,17 +32,37 @@ RUN apt-get update \ | |
WORKDIR /srv/app | ||
COPY Gemfile Gemfile.lock ./ | ||
RUN gem install bundler:1.17.3 | ||
#RUN bundle install | ||
|
||
# Clean up Bundle | ||
RUN bundle install --without development test && \ | ||
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 . . | ||
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 mkdir -p tmp/pids | ||
|
||
RUN RAILS_ENV=production SECRET_KEY_BASE=fake_out_devise bundle exec rake assets:precompile | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.