-
Notifications
You must be signed in to change notification settings - Fork 1
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
Docker configuration for production, development and testing #23
base: dev
Are you sure you want to change the base?
Changes from 9 commits
10a0210
ea2ed88
76a97d1
f14cc48
6bc3aba
a1ba26a
4a8ddaf
d8c63d0
0359d21
974c839
40dcbe4
a6e10a1
114922d
500a74f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
language: python | ||
python: | ||
- "3.5" | ||
language: generic | ||
sudo: required | ||
services: | ||
- docker | ||
before_script: | ||
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | ||
- chmod +x ./cc-test-reporter | ||
- ./cc-test-reporter before-build | ||
script: | ||
- flake8 api_graphql app data_models | ||
- yapf -pdr api_graphql app data_models -e '**/migrations' -e '**/snapshots' | ||
- isort -c -rc api_graphql app data_models | ||
- py.test --cov-report=xml | ||
- docker-compose run test | ||
after_script: | ||
- ./cc-test-reporter after-build | ||
- docker-compose run test ./cc-test-reporter after-build | ||
env: | ||
global: | ||
- GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM alpine:3.7 | ||
|
||
ENV APP_DIR=/srv/app | ||
|
||
RUN mkdir -p $APP_DIR | ||
WORKDIR $APP_DIR | ||
|
||
RUN apk add --update --no-cache git gcc libc-dev python3 python3-dev jpeg-dev zlib-dev | ||
ENV LIBRARY_PATH=/lib:/usr/lib | ||
|
||
COPY requirements.txt . | ||
RUN pip3 --no-cache-dir install -r requirements.txt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM kapina_base:latest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Meir eit spørsmål, men er ikkje det meir anbefalt å bruke Docker sin multi-stage build, for å få til fleire nivå? Usikker korleis dette fungerer rundt |
||
|
||
RUN apk add --update --no-cache uwsgi-python3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
version: '3' | ||
services: | ||
base: | ||
image: kapina_base:latest | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.base | ||
test: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.base | ||
volumes: | ||
- .:/srv/app/ | ||
command: ./docker/run_tests.sh | ||
environment: | ||
- GIT_COMMITTED_AT | ||
- CC_TEST_REPORTER_ID | ||
dev: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.base | ||
volumes: | ||
- .:/srv/app/ | ||
command: ./docker/run_dev.sh | ||
ports: | ||
- "8000:8000" | ||
environment: | ||
- REVOLT_DEBUG | ||
- REVOLT_ALLOWED_HOSTS | ||
- REVOLT_STATIC_ROOT | ||
- REVOLT_MEDIA_ROOT | ||
- REVOLT_SECRET_KEY | ||
- REVOLT_RAVEN_DSN | ||
- DATABASE_URL | ||
production: | ||
depends_on: | ||
- base | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.prod | ||
volumes: | ||
- .:/srv/app/ | ||
command: ./docker/run_production.sh | ||
ports: | ||
- "8000:8000" | ||
environment: | ||
- REVOLT_DEBUG=false | ||
- REVOLT_ALLOWED_HOSTS | ||
- REVOLT_STATIC_ROOT | ||
- REVOLT_MEDIA_ROOT | ||
- REVOLT_SECRET_KEY | ||
- REVOLT_RAVEN_DSN | ||
- DATABASE_URL |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
python3 manage.py migrate | ||
python3 manage.py runserver 0.0.0.0:8000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
python3 manage.py migrate | ||
python3 manage.py collectstatic --no-input | ||
uwsgi -i uwsgi.ini |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
flake8 api_graphql app data_models | ||
yapf -pdr api_graphql app data_models -e '**/migrations' -e '**/snapshots' | ||
isort -c -rc api_graphql app data_models | ||
py.test --cov-report=xml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[uwsgi] | ||
module = app.wsgi:application | ||
vacuum = True | ||
master = True | ||
http-socket = :8000 | ||
static-map = /static=./staticfiles | ||
static-map = /media=./mediafiles | ||
plugins = python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En liten kommentar. Blir ikkje dette automatisk gjort når du setter
$APP_DIR
til å vereWORKDIR
?