Skip to content

Commit

Permalink
Adjust how/when to build static assets
Browse files Browse the repository at this point in the history
Local setup was previously dependent on there not being a /taui/assets/ dir, that way docker would ignore the command to copy on initial build in scripts/update when the assets had not been bundled yet. However, this isn't a very reliable setup since scripts/update could be called from a local environment and /taui/assets/ has potential to exist but be empty, which would throw an error on build. Instead, this waits to build the django container until after taui is built and bundled, so regardless of dev environment the build can succeed.
  • Loading branch information
rachelekm committed May 10, 2022
1 parent a61a27f commit a81bf24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 5 additions & 0 deletions scripts/cibuild
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
REACT_APP_GIT_COMMIT="${GIT_COMMIT}" \
./scripts/update

docker-compose \
-f docker-compose.yml \
run --rm --no-deps --entrypoint "bash -c" taui \
"yarn install && yarn build"

# Build tagged container images
GIT_COMMIT="${GIT_COMMIT}" docker-compose \
-f docker-compose.yml \
Expand Down
10 changes: 3 additions & 7 deletions scripts/update
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
usage
else
# Ensure container images are current
docker-compose build

# Build static asset bundle
docker-compose \
-f docker-compose.yml \
run --rm --no-deps --entrypoint "bash -c" taui \
"yarn install && yarn build"
# Separated to build taui static assets before copied to django container
docker-compose build taui
docker-compose build database django

# Bring up PostgreSQL and Django in a way that respects
# configured service health checks.
Expand Down
1 change: 1 addition & 0 deletions taui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ COPY . /usr/local/src
WORKDIR /usr/local/src

RUN yarn install
RUN yarn build

0 comments on commit a81bf24

Please sign in to comment.