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

Upgrades Node version 6.11.0 -> 10.15.1 #179

Merged
merged 4 commits into from
Feb 22, 2019
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
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