Skip to content

Add per-project, admin-only container image configuration #1596

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

Merged
merged 1 commit into from
Aug 26, 2015
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
5 changes: 4 additions & 1 deletion readthedocs/doc_builder/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,12 @@ def update_build_from_container_state(self):
def create_container(self):
'''Create docker container'''
client = self.get_client()
image = self.container_image
if self.project.container_image is not None:
image = self.project.container_image
try:
self.container = client.create_container(
image=self.container_image,
image=image,
command=('/bin/sh -c "sleep {time}; exit {exit}"'
.format(time=self.container_time_limit,
exit=DOCKER_TIMEOUT_EXIT_CODE)),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('projects', '0003_project_cdn_enabled'),
]

operations = [
migrations.AddField(
model_name='project',
name='container_image',
field=models.CharField(max_length=64, null=True, verbose_name='Alternative container image', blank=True),
),
]
4 changes: 4 additions & 0 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ class Project(models.Model):
help_text=_('Type of documentation you are building. <a href="http://'
'sphinx-doc.org/builders.html#sphinx.builders.html.'
'DirectoryHTMLBuilder">More info</a>.'))

# Project features
allow_comments = models.BooleanField(_('Allow Comments'), default=False)
comment_moderation = models.BooleanField(_('Comment Moderation)'), default=False)
cdn_enabled = models.BooleanField(_('CDN Enabled'), default=False)
Expand All @@ -116,6 +118,8 @@ class Project(models.Model):
help_text=_("Google Analytics Tracking ID "
"(ex. <code>UA-22345342-1</code>). "
"This may slow down your page loads."))
container_image = models.CharField(
_('Alternative container image'), max_length=64, null=True, blank=True)

# Sphinx specific build options.
enable_epub_build = models.BooleanField(
Expand Down