-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move root-required bits of drama-free-django build into Dockerfile (#…
…5145) * Moves OS dependencies into Dockerfile This change was made to make it easier to run the build and test processes as alternate users, which is sometimes necessary to make the volumes permissions line up with the Docker host. Additionally, changes paths using `/`, which was causing permissions issues when running as non-root. * Converts dfd scripts to use docker build, then run * Revert back to centos:6 Docker image * Revert to original `static_out` path * Override PIP_NO_CACHE_DIR on pip upgrade The version of pip that comes with SCL python27 has a bug that fails to process PIP_NO_CACHE_DIR correctly. Adding --no-cache-dir overrides the envvar, preventing the error. * Removes Mac-specific `cached` volume attribute * Removes unneeded `which` package * Removes unneeded question comment * Add headings and "Notes" section to DFD README.md * Add yarn cache warning to DFD Docker README * Fix yarn warnings by setting $HOME in Dockerfile * Fix typo in drama-free-django/Dockerfile Co-Authored-By: Andy Chosak <[email protected]>
- Loading branch information
Showing
7 changed files
with
78 additions
and
22 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM centos:6 | ||
|
||
ENV SCL_PYTHON_VERSION python27 | ||
|
||
# Disables pip cache, which reduces build time, and suppresses warnings when run as non-root. | ||
ENV PIP_NO_CACHE_DIR true | ||
|
||
ENV DFD_DIR /src/cfgov-refresh | ||
|
||
# Must be world writable since alternate uid:gid may be patched in at `docker run` time. | ||
RUN mkdir -p ${DFD_DIR} && chmod 777 ${DFD_DIR} | ||
WORKDIR ${DFD_DIR} | ||
|
||
# Sets a consistent $HOME no matter which user the container runs under. This prevents | ||
# permissions issues caused by Docker's default `/` home directory. | ||
ENV HOME /tmp/dfd-home | ||
RUN mkdir -p ${HOME} && chmod 777 ${HOME} | ||
|
||
# Install dependencies | ||
# NOTE: You MUST upgrade pip before using it further. The version packaged with SCL has issues | ||
# with both setuptools and the PIP_NO_CACHE_DIR envvar (hence the --no-cache-dir override). | ||
RUN yum install -y centos-release-scl && \ | ||
curl -sL https://rpm.nodesource.com/setup_10.x | bash - && \ | ||
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo && \ | ||
yum install -y ${SCL_PYTHON_VERSION} gcc git nodejs yarn && \ | ||
echo "source scl_source enable ${SCL_PYTHON_VERSION}" > /etc/profile.d/scl_python.sh && \ | ||
source /etc/profile && \ | ||
pip install --no-cache-dir -U pip && \ | ||
pip install -U git+https://github.com/cfpb/drama-free-django.git | ||
|
||
COPY _build.sh _test.sh docker-entrypoint.sh ./ | ||
|
||
ENTRYPOINT ["./docker-entrypoint.sh"] |
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
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 |
---|---|---|
@@ -1,3 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker run -v `pwd`:/cfgov centos:6 /cfgov/docker/drama-free-django/_build.sh | ||
set -e | ||
|
||
docker build -t cfgov-dfd-builder docker/drama-free-django | ||
|
||
docker run \ | ||
--rm \ | ||
-u $(id -u):$(id -g) \ | ||
-v $(pwd):/cfgov \ | ||
cfgov-dfd-builder ./_build.sh |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash --login | ||
# This entrypoint is used primarily as means of setting up a consistent | ||
# shell environment no matter which user the process runs as. By using | ||
# --login, it guarantees /etc/profile is always sourced, unlike the | ||
# non-login, non-interactive shell you get by default with `docker run`. | ||
|
||
exec "$@" |
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,3 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker run -v `pwd`:/cfgov centos:6 /cfgov/docker/drama-free-django/_test.sh | ||
set -e | ||
|
||
docker build -t cfgov-dfd-builder docker/drama-free-django | ||
|
||
docker run \ | ||
--rm \ | ||
-u $(id -u):$(id -g) \ | ||
-v $(pwd):/cfgov \ | ||
cfgov-dfd-builder ./_test.sh |