-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a docker image for dev and tests
- Loading branch information
1 parent
b877395
commit 4a1371f
Showing
6 changed files
with
113 additions
and
9 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,36 @@ | ||
FROM alpine | ||
|
||
RUN apk update | ||
RUN apk add openssl | ||
RUN openssl req \ | ||
-newkey rsa:4096 -nodes -sha256 -keyout server.key \ | ||
-x509 -days 365 -out server.crt \ | ||
-subj "/C=FR/ST=Paris/L=Paris/O=Crash-Stop/OU=Crash/CN=crash-stop.org" | ||
|
||
FROM python:slim | ||
|
||
ENV DATABASE_URL=postgresql://crash:stop@postgres:5432/crashstop | ||
ENV MEMCACHEDCLOUD_SERVERS=memcached:11211 | ||
ENV MEMCACHEDCLOUD_USERNAME= | ||
ENV MEMCACHEDCLOUD_PASSWORD= | ||
ENV PORT=8080 | ||
ENV PYTHONPATH=. | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
WORKDIR /tmp | ||
|
||
ADD requirements.txt /tmp/requirements.txt | ||
ADD test-requirements.txt /tmp/test-requirements.txt | ||
|
||
RUN pip install -r requirements.txt | ||
RUN pip install -r test-requirements.txt | ||
|
||
WORKDIR / | ||
|
||
COPY --from=0 server.* / | ||
ADD Procfile . | ||
RUN sed -i 's/gunicorn/gunicorn --reload --reload-extra-file static --reload-extra-file templates --certfile=\/server.crt --keyfile=\/server.key/g' Procfile | ||
|
||
WORKDIR /code | ||
|
||
EXPOSE 8080 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
from crashstop import models, signatures | ||
|
||
|
||
while True: | ||
try: | ||
models.create() | ||
break | ||
except: # NOQA | ||
pass | ||
|
||
signatures.update() |
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,27 @@ | ||
version: "3" | ||
services: | ||
tests: | ||
build: . | ||
volumes: | ||
- .:/code | ||
command: > | ||
bash -c "python bin/init.py && | ||
PYTHONDONTWRITEBYTECODE=1 pytest -p no:cacheprovider -vv tests/" | ||
depends_on: | ||
- postgres | ||
- memcached | ||
links: | ||
- postgres | ||
- memcached | ||
postgres: | ||
image: postgres | ||
environment: | ||
- POSTGRES_USER=crash | ||
- POSTGRES_PASSWORD=stop | ||
- POSTGRES_DB=crashstop | ||
expose: | ||
- 5432 | ||
memcached: | ||
image: memcached | ||
expose: | ||
- 11211 |
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 @@ | ||
version: "3" | ||
services: | ||
web: | ||
build: . | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- .:/code | ||
command: > | ||
bash -c "python bin/init.py && | ||
honcho -d . -f /Procfile start" | ||
depends_on: | ||
- postgres | ||
- memcached | ||
links: | ||
- postgres | ||
- memcached | ||
postgres: | ||
image: postgres | ||
environment: | ||
- POSTGRES_USER=crash | ||
- POSTGRES_PASSWORD=stop | ||
- POSTGRES_DB=crashstop | ||
expose: | ||
- 5432 | ||
memcached: | ||
image: memcached | ||
expose: | ||
- 11211 |
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