Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix static assets on staging #484

Merged
merged 5 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ services:
- DJANGO_SECRET_KEY=secret
- DJANGO_LOG_LEVEL=INFO
build:
context: ./src/backend
dockerfile: Dockerfile
context: ./
dockerfile: ./src/backend/Dockerfile
volumes:
- ./src/backend:/usr/local/src/backend
- $HOME/.aws:/root/.aws:ro
- type: bind
source: ./taui/index.html
target: /usr/local/src/backend/static/index.html
- ./taui/assets:/usr/local/src/backend/static/assets
- ./taui/index.html:/usr/local/src/backend/static/index.html
working_dir: /usr/local/src/backend
depends_on:
database:
Expand Down
10 changes: 9 additions & 1 deletion scripts/update
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
usage
else
# Ensure container images are current
docker-compose build
docker-compose build taui

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

docker-compose build database django

# Bring up PostgreSQL and Django in a way that respects
# configured service health checks.
Expand Down
7 changes: 5 additions & 2 deletions src/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ FROM quay.io/azavea/django:3.2-python3.10-slim
RUN mkdir -p /usr/local/src/backend
WORKDIR /usr/local/src/backend

COPY requirements.txt /usr/local/src/backend/
COPY ./src/backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . /usr/local/src/backend
COPY ./src/backend /usr/local/src/backend

COPY ./taui/assets/ /usr/local/src/backend/static/assets
COPY ./taui/index.html /usr/local/src/backend/static/index.html

CMD ["-b :8085", \
"--workers=2", \
Expand Down