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

Add a contrib Dockerfile for local build image on Linux #4608

Merged
merged 5 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
15 changes: 15 additions & 0 deletions contrib/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM readthedocs/build:latest

ARG username
ARG uid=$uid
ARG gid=$uid

ENV UID ${uid}
ENV GID ${gid}

USER root
RUN groupadd --gid ${GID} docscustom
agjohnson marked this conversation as resolved.
Show resolved Hide resolved
RUN usermod --uid ${UID} --gid ${GID} docs
USER docs

CMD ["/bin/bash"]
11 changes: 11 additions & 0 deletions contrib/docker_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

username=`id -nu`
uid=`id -u`
gid=`id -g`

docker build \
-t readthedocs/build:latest-dev \
--build-arg uid=${uid} \
--build-arg gid=${gid} \
.
agjohnson marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 13 additions & 1 deletion contrib/readme.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
Contrib
=======

Building development Docker image
---------------------------------

If you run Linux, you likely need to build a local Docker image that extends our
default image::

cd contrib/
./docker_build.sh
agjohnson marked this conversation as resolved.
Show resolved Hide resolved

Running Read the Docs via Supervisord
=====================================
-------------------------------------

This is the easiest way to start all of the commands you'll need for development
in an environment relatively close to the production evironment. All you need is
Expand Down
16 changes: 16 additions & 0 deletions docs/development/buildenvironments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,19 @@ DOCKER_VERSION
Version of the API to use for the Docker API client.

Default: :djangosetting:`DOCKER_VERSION`


Local development
-----------------

On Linux development environments, it's likely that your UID and GID do not
match the ``docs`` user that is set up as the default user for builds. In this
case, it's necessary to make a new image that overrides this user::

cd contrib/
./docker_build.sh

This will create a new image, ``readthedocs/build:latest-dev``,
which you can re-tag as ``latest`` to make Read the Docs use this image instead::

docker tag readthedocs/build:latest-dev readthedocs/build:latest