Add prototype docker container
This commit is contained in:
parent
3af3b997d7
commit
e181e96623
|
@ -30,3 +30,4 @@ repomaker-static/
|
|||
/build/
|
||||
/dist/
|
||||
/repomaker.egg-info/
|
||||
/docker/data
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
FROM registry.gitlab.com/fdroid/ci-images-repomaker:latest
|
||||
MAINTAINER team@f-droid.org
|
||||
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
WORKDIR /repomaker
|
||||
|
||||
ADD . /repomaker
|
||||
|
||||
RUN apt update && apt install netcat -y && \
|
||||
pip3 install -r requirements.txt && \
|
||||
npm install
|
||||
|
||||
COPY docker/settings_docker.py ./repomaker/
|
||||
COPY docker/wait-for ./
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
version: '2'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres
|
||||
volumes:
|
||||
- ./pgdata:/var/lib/postgresql/data
|
||||
|
||||
web:
|
||||
build: ..
|
||||
command: bash -c './wait-for db:5432 -- python3 manage.py migrate --settings repomaker.settings_docker && python3 manage.py runserver 0.0.0.0:8000 --settings repomaker.settings_docker'
|
||||
volumes:
|
||||
- ./data:/repomaker/data
|
||||
ports:
|
||||
- "80:8000"
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
tasks:
|
||||
build: ..
|
||||
command: bash -c './wait-for web:8000 -- python3 manage.py process_tasks --settings repomaker.settings_docker'
|
||||
volumes:
|
||||
- ./data:/repomaker/data
|
||||
depends_on:
|
||||
- db
|
||||
- web
|
||||
|
||||
# vim: set tabstop=2:softtabstop=2:shiftwidth=2
|
|
@ -0,0 +1,53 @@
|
|||
from pkg_resources import Requirement, resource_filename
|
||||
from repomaker.settings import *
|
||||
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'postgres',
|
||||
'USER': 'postgres',
|
||||
'HOST': 'db',
|
||||
'PORT': 5432,
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_USER_MODE = False
|
||||
|
||||
LOGIN_REDIRECT_URL = "/"
|
||||
# http://django-allauth.readthedocs.io/en/latest/installation.html
|
||||
INSTALLED_APPS += [
|
||||
'allauth',
|
||||
'allauth.socialaccount',
|
||||
# 'allauth.socialaccount.providers.amazon',
|
||||
# 'allauth.socialaccount.providers.baidu',
|
||||
# 'allauth.socialaccount.providers.bitbucket_oauth2',
|
||||
# 'allauth.socialaccount.providers.dropbox_oauth2',
|
||||
# 'allauth.socialaccount.providers.facebook',
|
||||
# 'allauth.socialaccount.providers.github',
|
||||
# 'allauth.socialaccount.providers.gitlab',
|
||||
# 'allauth.socialaccount.providers.google',
|
||||
# 'allauth.socialaccount.providers.linkedin_oauth2',
|
||||
'allauth.socialaccount.providers.openid',
|
||||
# 'allauth.socialaccount.providers.reddit',
|
||||
# 'allauth.socialaccount.providers.slack',
|
||||
# 'allauth.socialaccount.providers.stackexchange',
|
||||
# 'allauth.socialaccount.providers.twitter',
|
||||
# 'allauth.socialaccount.providers.weibo',
|
||||
]
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
'allauth.account.auth_backends.AuthenticationBackend',
|
||||
)
|
||||
ACCOUNT_FORMS = {
|
||||
'login': 'repomaker.views.RmLoginForm',
|
||||
'reset_password': 'repomaker.views.RmResetPasswordForm',
|
||||
'signup': 'repomaker.views.RmSignupForm',
|
||||
}
|
||||
ACCOUNT_EMAIL_VERIFICATION = "none"
|
||||
|
||||
# TODO
|
||||
#DEFAULT_REPO_STORAGE = [
|
||||
# (os.path.join(DATA_DIR, 'repos'), 'http://127.0.0.1/repos/'),
|
||||
#]
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/sh
|
||||
|
||||
TIMEOUT=15
|
||||
QUIET=0
|
||||
|
||||
echoerr() {
|
||||
if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
exitcode="$1"
|
||||
cat << USAGE >&2
|
||||
Usage:
|
||||
$cmdname host:port [-t timeout] [-- command args]
|
||||
-q | --quiet Do not output any status messages
|
||||
-t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout
|
||||
-- COMMAND ARGS Execute command with args after the test finishes
|
||||
USAGE
|
||||
exit "$exitcode"
|
||||
}
|
||||
|
||||
wait_for() {
|
||||
for i in `seq $TIMEOUT` ; do
|
||||
nc -z "$HOST" "$PORT" > /dev/null 2>&1
|
||||
|
||||
result=$?
|
||||
if [ $result -eq 0 ] ; then
|
||||
if [ $# -gt 0 ] ; then
|
||||
exec "$@"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "Operation timed out" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
*:* )
|
||||
HOST=$(printf "%s\n" "$1"| cut -d : -f 1)
|
||||
PORT=$(printf "%s\n" "$1"| cut -d : -f 2)
|
||||
shift 1
|
||||
;;
|
||||
-q | --quiet)
|
||||
QUIET=1
|
||||
shift 1
|
||||
;;
|
||||
-t)
|
||||
TIMEOUT="$2"
|
||||
if [ "$TIMEOUT" = "" ]; then break; fi
|
||||
shift 2
|
||||
;;
|
||||
--timeout=*)
|
||||
TIMEOUT="${1#*=}"
|
||||
shift 1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
--help)
|
||||
usage 0
|
||||
;;
|
||||
*)
|
||||
echoerr "Unknown argument: $1"
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$HOST" = "" -o "$PORT" = "" ]; then
|
||||
echoerr "Error: you need to provide a host and port to test."
|
||||
usage 2
|
||||
fi
|
||||
|
||||
wait_for "$@"
|
|
@ -1,3 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
pep8 --show-pep8 --max-line-length=100 --exclude=setup.py,.git,build,migrations .
|
||||
pep8 --show-pep8 --max-line-length=100 --exclude=setup.py,.git,build,migrations,docker .
|
||||
|
|
Loading…
Reference in New Issue