Skip to content

Commit

Permalink
fix #874: run gulp in docker; not during collectstatic
Browse files Browse the repository at this point in the history
  • Loading branch information
groovecoder committed Jun 16, 2021
1 parent 236ad23 commit c31ee05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
FROM node:14 AS builder
WORKDIR /app
COPY package*.json ./
COPY gulpfile.js ./
COPY static ./static/
RUN npm install
RUN ./node_modules/.bin/gulp build

FROM python:3.7.9

RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y libpq-dev
RUN apt-get install -y nodejs
RUN apt-get update && apt-get install -y libpq-dev
RUN pip install --upgrade pip

RUN groupadd --gid 10001 app && \
Expand All @@ -13,13 +19,10 @@ WORKDIR /app
EXPOSE 8000

USER app
COPY --from=builder --chown=app /app/static ./static

COPY --chown=app ./requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt

COPY package*.json ./
RUN npm install

COPY --chown=app . /app
COPY --chown=app .env-dist /app/.env

Expand Down
5 changes: 5 additions & 0 deletions privaterelay/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ def _get_initial_middleware():
os.path.join(BASE_DIR, 'static'),
]

# for dev statics, we use django-gulp during runserver.
# for stage/prod statics, we run "gulp build" in docker.
# so, squelch django-gulp in prod so it doesn't run gulp during collectstatic:
GULP_PRODUCTION_COMMAND = ''

SITE_ID = 1

AUTHENTICATION_BACKENDS = (
Expand Down

0 comments on commit c31ee05

Please sign in to comment.