Skip to content

Commit

Permalink
Copy all files when building the test Docker image
Browse files Browse the repository at this point in the history
This is only for the test target and ensures that all the files that
could be linted locally are also linted on CI. We need to be mindful
of files that get added to the project, if they are secrets or
superfluous we should add them to the .dockerignore file.

This change doesn't increase the size of the Docker image by much but it
will increase build times slightly because of the way that Docker
caches layers of a Dockerfile, whenever a file is changed it will need
to redo that copy step.
  • Loading branch information
Robbie Paul committed Feb 18, 2020
1 parent 1ee3d00 commit debc9c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,14 @@
/log/
/node_modules/
/tmp/
/.git/

localhost.crt
localhost.key

.env
.env.local

.rakeTasks
.byebug_history
.generators
18 changes: 5 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,11 @@ COPY --from=shellcheck / /opt/shellcheck/
ENV PATH /opt/shellcheck/bin:${PATH}
# End

# Copy test code (sorted by vague frequency of change for caching)
COPY .prettierignore ${APP_HOME}/.prettierignore
COPY .prettierrc ${APP_HOME}/.prettierrc
COPY .rspec ${APP_HOME}/.rspec
COPY .standard.yml ${APP_HOME}/.standard.yml

COPY spec ${APP_HOME}/spec
# End

# Copy files for linting (sorted by vague frequency of change for caching)
COPY docs ${APP_HOME}/docs
COPY *.md ${APP_HOME}/
COPY azure ${APP_HOME}/azure
# Copy all files
# This is only for the test target and ensures that all the files that could be linted locally are also linted on CI.
# We need to be mindful of files that get added to the project, if they are secrets or superfluous we should add them
# to the .dockerignore file.
COPY . ${APP_HOME}/
# End

CMD [ "bundle", "exec", "rake" ]

0 comments on commit debc9c3

Please sign in to comment.