Skip to content

Commit

Permalink
refactor(dockerfile): move layers around for speed improvement (#1510)
Browse files Browse the repository at this point in the history
  • Loading branch information
MindTooth authored Oct 13, 2023
1 parent 5265fa8 commit cc54585
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -618,4 +618,4 @@ RUBY VERSION
ruby 3.1.4p223

BUNDLED WITH
2.4.18
2.4.10
27 changes: 23 additions & 4 deletions containers/docker/pwpush/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,22 @@ ARG BUNDLE_DEPLOYMENT
LABEL org.opencontainers.image.authors ='pglombardo@hey.com'

# Required packages
RUN apk add --no-cache build-base git curl tzdata zlib-dev nodejs yarn libc6-compat sqlite-dev mariadb-dev libpq-dev
RUN apk add --no-cache \
build-base \
curl \
git \
libc6-compat \
libpq-dev \
mariadb-dev \
nodejs \
sqlite-dev \
tzdata \
yarn

ENV APP_ROOT=/opt/PasswordPusher

WORKDIR ${APP_ROOT}
COPY ./ ${APP_ROOT}/
COPY Gemfile Gemfile.lock package.json yarn.lock ./

ENV RACK_ENV=production RAILS_ENV=production

Expand All @@ -30,6 +40,8 @@ RUN bundle config set without "${BUNDLE_WITHOUT}" \

RUN yarn install

COPY ./ ${APP_ROOT}/

# Set DATABASE_URL to sqlite to have a ready
# to use db file for ephemeral configuration
ENV DATABASE_URL=sqlite3:db/db.sqlite3
Expand All @@ -53,7 +65,14 @@ ARG BUNDLE_DEPLOYMENT
LABEL maintainer='pglombardo@hey.com'

# install packages
RUN apk add --no-cache tzdata bash nodejs libc6-compat sqlite-dev mariadb-connector-c libpq
RUN apk add --no-cache \
bash \
libc6-compat \
libpq \
mariadb-connector-c \
nodejs \
sqlite-dev \
tzdata

# Create a user and group to run the application
ARG UID=1000
Expand All @@ -75,4 +94,4 @@ RUN bundle config set without "${BUNDLE_WITHOUT}" \

USER pwpusher
EXPOSE 5100
ENTRYPOINT ["containers/docker/pwpush/entrypoint.sh"]
ENTRYPOINT ["containers/docker/pwpush/entrypoint.sh"]

0 comments on commit cc54585

Please sign in to comment.