Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
Merge pull request #179 from freedomofpress/upgrade-node-to-10.x
Browse files Browse the repository at this point in the history
Upgrades Node version 6.11.0 -> 10.15.1
  • Loading branch information
harrislapiroff authored Feb 22, 2019
2 parents 12f976b + 6f36978 commit 32ec29b
Show file tree
Hide file tree
Showing 8 changed files with 7,714 additions and 6 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,3 @@ coverage.xml

#visual studio code
.vscode

# ignore dynamically generated dockerfiles
docker/DevDjangoDockerfile
docker/ProdDjangoDockerfile
2 changes: 2 additions & 0 deletions ci-docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ services:
build:
context: .
dockerfile: docker/ProdDjangoDockerfile
args:
NODE_VER: 10.15.1-alpine
image: quay.io/freedomofpress/securethenews
env_file: ${DJANGO_ENV_FILE}
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
context: .
dockerfile: docker/NodeDockerfile
args:
NODE_VER: 4.8.2-alpine
NODE_VER: 10.15.1-alpine
USERID: ${UID:?err}
volumes:
- ./:/var/www/django
Expand Down
2 changes: 1 addition & 1 deletion docker/1-prod-node
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VER=4.8.2-alpine
ARG NODE_VER
FROM node:${NODE_VER} AS node-assets

# Make npm output less verbose
Expand Down
37 changes: 37 additions & 0 deletions docker/DevDjangoDockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 3.6.5-alpine3.7 - May 11, 2018
FROM python@sha256:bfac58481666aeb60ff6354e81afe888cc8c7b1effb1039870377fc7fa86ef43

RUN apk add --no-cache \
bash \
curl \
gcc \
git \
# pillow dep
jpeg-dev \
libffi-dev \
musl-dev \
paxctl \
postgresql-dev \
# pillow dep
tiff-dev \
# pillow dep
zlib-dev

COPY docker/django-start.sh /usr/local/bin
RUN chmod +x /usr/local/bin/django-start.sh
COPY docker/django-start.sh /usr/local/bin
RUN chmod +x /usr/local/bin/django-start.sh

ARG USERID
RUN adduser -D -g "" -u "${USERID}" gcorn

RUN paxctl -cm /usr/local/bin/python
COPY securethenews/requirements.txt /requirements.txt
RUN pip install -r /requirements.txt

RUN mkdir /django-logs && \
chown -R gcorn: /django-logs

EXPOSE 8000
USER gcorn
CMD django-start.sh
62 changes: 62 additions & 0 deletions docker/ProdDjangoDockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
ARG NODE_VER
FROM node:${NODE_VER} AS node-assets

# Make npm output less verbose
ENV NPM_CONFIG_LOGLEVEL warn

# Oddly, node-sass requires both python and make to build bindings
RUN apk add --no-cache paxctl python make g++
RUN paxctl -cm /usr/local/bin/node

# Install gulp globally so it can be used during builds
RUN npm install --global gulp-cli

COPY ./ /src-files
RUN cd /src-files && ( npm install && gulp build:production )
# 3.6.5-alpine3.7 - May 11, 2018
FROM python@sha256:bfac58481666aeb60ff6354e81afe888cc8c7b1effb1039870377fc7fa86ef43

RUN apk add --no-cache \
bash \
curl \
gcc \
git \
# pillow dep
jpeg-dev \
libffi-dev \
musl-dev \
paxctl \
postgresql-dev \
# pillow dep
tiff-dev \
# pillow dep
zlib-dev

COPY docker/django-start.sh /usr/local/bin
RUN chmod +x /usr/local/bin/django-start.sh
RUN adduser -D -g "" gcorn
LABEL MAINTAINER="Freedom of the Press Foundation"
LABEL APP="securethenews"

RUN paxctl -cm /usr/local/bin/python
COPY --from=node-assets /src-files/ /django/
# Unfortunately the chown flag in COPY is not
# available in my docker system version :(
RUN find /django -path /django/node_modules -prune -o -print -exec chown gcorn: '{}' \;

WORKDIR /django
RUN pip install -r /django/securethenews/requirements.txt

# Really not used in production. Needed for mapped named volume
# permission handling https://github.com/docker/compose/issues/3270
RUN mkdir /django-media /django-static /django-logs && \
chown -R gcorn: /django-media && \
chown -R gcorn: /django-static && \
chown -R gcorn: /django-logs

RUN mkdir -p /etc/gunicorn && chown -R gcorn: /etc/gunicorn
COPY docker/gunicorn/gunicorn.py /etc/gunicorn/gunicorn.py

EXPOSE 8000
USER gcorn
CMD django-start.sh
Loading

0 comments on commit 32ec29b

Please sign in to comment.