-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #295 from freedomofpress/k8s-container
Add k8s container
- Loading branch information
Showing
7 changed files
with
148 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# sha256 as of 2021-11-09 | ||
FROM python:3.9-slim-bullseye@sha256:408de0cf1a057f5501ee6642ad24a4762738f63bacf09fb4c8d861669260b01e AS sphinx | ||
|
||
RUN apt-get -q update && apt-get -qy upgrade && apt-get -qy install git make latexmk texlive-latex-extra | ||
COPY ./ . | ||
RUN pip install -r requirements/requirements.txt | ||
RUN deploy/build | ||
|
||
# sha256 as of 2021-11-09 | ||
FROM nginx:mainline-alpine@sha256:af466e4f12e3abe41fcfb59ca0573a3a5c640573b389d5287207a49d1324abd8 | ||
|
||
COPY deploy/nginx.conf /etc/nginx | ||
RUN mkdir -p /opt/nginx/run /opt/nginx/webroot/en/latest /opt/nginx/webroot/en/stable && chown -R nginx:nginx /opt/nginx | ||
|
||
USER nginx | ||
COPY --from=sphinx --chown=nginx:nginx build/stable/html/html/ /opt/nginx/webroot/en/stable/ | ||
COPY --from=sphinx --chown=nginx:nginx build/stable/html/latex/SecureDrop.pdf /opt/nginx/webroot/en/stable/ | ||
COPY --from=sphinx --chown=nginx:nginx build/latest/html/html/ /opt/nginx/webroot/en/latest/ | ||
COPY --from=sphinx --chown=nginx:nginx build/latest/html/latex/SecureDrop.pdf /opt/nginx/webroot/en/latest/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
# | ||
# Run the docs build process twice, producing `build/latest` and | ||
# `build/stable` instead of `docs/_build`. | ||
|
||
set -e | ||
|
||
|
||
latest_branch=main | ||
stable_tag=$(git tag --sort=version:refname | tail -1) | ||
|
||
do_build() { | ||
git checkout "$1" | ||
export SECUREDROP_DOCS_RELEASE="$2" | ||
|
||
make html | ||
# Due to remote SVG includes not working (they didn't work on RTD either), | ||
# the LaTeX build will pause and wait for the user to press enter. It will | ||
# also exit with an error status. Because of this failure, the TOC will | ||
# not be correctly generated on the first run, and we must do it twice. | ||
yes '' | make latexpdf || : | ||
yes '' | make latexpdf || : | ||
|
||
mkdir -p build | ||
mv docs/_build "build/${2}" | ||
} | ||
|
||
do_build "$stable_tag" stable | ||
do_build "$latest_branch" latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
pid /opt/nginx/run/nginx.pid; | ||
|
||
events { | ||
} | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
sendfile on; | ||
|
||
server { | ||
listen 5080; | ||
absolute_redirect off; | ||
port_in_redirect off; | ||
|
||
client_body_temp_path /opt/nginx/run/client_temp; | ||
proxy_temp_path /opt/nginx/run/proxy_temp_path; | ||
fastcgi_temp_path /opt/nginx/run/fastcgi_temp; | ||
uwsgi_temp_path /opt/nginx/run/uwsgi_temp; | ||
scgi_temp_path /opt/nginx/run/scgi_temp; | ||
|
||
merge_slashes off; | ||
|
||
location / { | ||
root /opt/nginx/webroot; | ||
index index.html; | ||
|
||
rewrite ^/$ /en/stable/ redirect; | ||
rewrite ^/_/downloads/en/stable/pdf/$ /en/stable/SecureDrop.pdf permanent; | ||
rewrite ^/_/downloads/en/latest/pdf/$ /en/latest/SecureDrop.pdf permanent; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.rst-other-versions .current-release { font-weight: 700; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{% extends "!layout.html" %} | ||
|
||
{% block extrahead %} | ||
<link rel="stylesheet" href="_static/releases.css" type="text/css" /> | ||
{% endblock %} | ||
|
||
{% block extrabody %} | ||
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> | ||
<span class="rst-current-version" data-toggle="rst-current-version"> | ||
<span class="fa fa-book">SecureDrop Docs</span> | ||
v: {{ release }} | ||
<span class="fa fa-caret-down"></span> | ||
</span> | ||
<div class="rst-other-versions"> | ||
<dl> | ||
<dt>Versions</dt> | ||
<dd{% if release == "stable" %} class="current-release"{% endif %}> | ||
<a href="/en/stable/{{ pagename }}.html">stable</a> | ||
</dd> | ||
<dd{% if release == "latest" %} class="current-release"{% endif %}> | ||
<a href="/en/latest/{{ pagename }}.html">latest</a> | ||
</dd> | ||
</dl> | ||
<dl> | ||
<dt>Downloads</dt> | ||
<dd><a href="/en/{{ release }}/SecureDrop.pdf">PDF</a></dd> | ||
</dl> | ||
<hr> | ||
<small> | ||
A project of <a href="https://freedom.press/">Freedom of the Press Foundation</a> · | ||
<a href="https://freedom.press/privacy-policy/">Privacy Policy</a> | ||
</small> | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters