Skip to content

Commit

Permalink
chore: add dockerfile debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
prototypicalpro committed Dec 9, 2020
1 parent 25e729f commit 3bd8acc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Dependency directory
node_modules
vendor

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
Expand Down
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
lib/
node_modules/
node_modules/
vendor/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Dependency directory
node_modules
vendor/

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
Expand Down
21 changes: 5 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,35 @@ RUN apt-get update && \
apt-get install --no-install-recommends -y $RUNTIME_DEPS $BUILD_DEPS && \
gem update --system --silent

# Create a dedicated user for running the application
RUN groupadd -r docker-group && useradd -r -g docker-group docker-user
USER docker-user

# Install ruby gems
COPY --chown=docker-user:docker-group Gemfile* ./
COPY Gemfile* ./
RUN bundle config path vendor/bundle && \
bundle install --jobs 4 --retry 3

# cleanup
USER root
RUN apt-get remove -y $BUILD_DEPS && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

FROM python:2.7-slim as python-deps

# Create a dedicated user for running the application
RUN groupadd -r docker-group && useradd -r -g docker-group docker-user
USER docker-user

# docutils for github-markup
RUN python -m pip install --upgrade pip && \
pip install docutils

FROM node:lts-slim

# Create a dedicated user for running the application
RUN groupadd -r docker-group && useradd -r -g docker-group docker-user
USER docker-user

# Copy Ruby dependencies
COPY --from=ruby-deps / /
COPY --from=python-deps / /

# Install node_modules
COPY --chown=docker-user:docker-group package*.json ./
COPY package*.json ./
RUN npm install --production

RUN bundle platform && bundle list

# move the rest of the project over
COPY --chown=docker-user:docker-group dist ./dist
COPY dist ./dist

ENTRYPOINT ["bundle", "exec", "node", "dist/index.js"]

0 comments on commit 3bd8acc

Please sign in to comment.