Last active
November 23, 2017 08:10
-
-
Save JayH5/9ee8844b834fff2a0f6cb05beb7e9b9f to your computer and use it in GitHub Desktop.
Django container fixture
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
from seaworthy.definitions import ContainerDefinition | |
class DjangoContainer(ContainerDefinition): | |
IMAGE = "seaworthy-demo:django" | |
WAIT_PATTERNS = (r"Booting worker",) | |
def __init__(self, name, socket_volume, static_volume, db_url): | |
super().__init__(name, self.IMAGE, self.WAIT_PATTERNS) | |
self.socket_volume = socket_volume | |
self.static_volume = static_volume | |
self.db_url = db_url | |
def base_kwargs(self): | |
return { | |
"volumes": { | |
self.socket_volume.inner(): "/var/run/gunicorn", | |
self.static_volume.inner(): "/app/static:ro", | |
}, | |
"environment": {"DATABASE_URL": self.db_url} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment