Skip to content
Snippets Groups Projects
Commit 8d75ef6b authored by Jan Maximilian Michal's avatar Jan Maximilian Michal
Browse files

Adding some CI/CD capabilitys (experimental)

parent d2193bc4
No related branches found
No related tags found
No related merge requests found
......@@ -7,16 +7,13 @@ stages:
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
build:
image: docker:latest
services:
- docker:dind
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN docker.gitlab.gwdg.de
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
......@@ -24,24 +21,19 @@ test:
stage: test
image: $IMAGE_TAG
services:
postgres:9.5
variables:
POSTGRES_DB: grady_dev
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB"
- postgres:9.5
script:
- coverage run manage.py test --noinput
- coverage report --skip-covered
staging:
state: staging
stage: staging
image: $IMAGE_TAG
services:
postgres:9.5
- postgres:9.5
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://staging.grady.janmax.org
image: $IMAGE_TAG
script:
- python3 manage.py migrate --noinput
- python3 manage.py loaddata core/fixtures/testdata-groups.json
- gunicorn --bind 0.0.0.0:8000 grady.wsgi
FROM python:3.6-alpine
ENV PYTHONUNBUFFERED 1
ENV DJANGO_DEV 1
RUN apk add --no-cache nodejs
RUN apk add --no-cache postgresql-dev
RUN apk add --no-cache gcc
RUN apk add --no-cache python3-dev
RUN apk add --no-cache musl-dev
RUN apk add --no-cache libgcrypt-dev
RUN apk add --no-cache libxslt-dev
RUN apk add --no-cache bash
RUN apk add --no-cache curl
RUN npm install yarn -g
RUN mkdir /code
......@@ -19,4 +17,7 @@ ADD . /code/
WORKDIR /code
RUN pip install -r requirements.txt
RUN yarn
RUN yarn install --modules-folder core/static/node_modules
RUN mkdir -p /usr/share/dict
RUN curl https://gitlab.gwdg.de/snippets/51/raw --output /usr/share/dict/words
......@@ -2,7 +2,7 @@ version: '3'
services:
postgres:
image: postgres:latest
image: postgres:9.5
web:
build: .
command:
......
......@@ -83,13 +83,9 @@ DATABASES = {
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'postgres',
'HOST': 'postgres',
'HOST': '0.0.0.0',
'PORT': '5432',
},
'filestorage': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'default_db.sqlite3'),
},
}
# Password validation
......@@ -122,9 +118,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
FIXTURE_DIRS = ['/core/fixtures/']
......
......@@ -21,5 +21,5 @@ DATABASES = {
'PASSWORD': 'postgres',
'HOST': 'postgres',
'PORT': '5432',
},
},
}
......@@ -5,5 +5,4 @@ django_compressor~=2.1.1
gunicorn~=19.7.0
psycopg2~=2.7.1
xlrd~=1.0.0
lxml~=3.8.0
pytest-cov~=2.5.1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment