diff --git a/.dockerignore b/.dockerignore index 713cdb7a..c2fa85b9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,6 @@ * !app/ +!frontend/ !tests/ !tools/ !.coveragerc @@ -18,3 +19,8 @@ app/**/staticfiles/ app/**/venv/ app/**/__pycache__/ tests/**/__pycache__/ + +frontend/.nuxt/ +frontend/coverage/ +frontend/dist/ +frontend/node_modules/ diff --git a/.travis.yml b/.travis.yml index cf67476f..813abc7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,9 @@ python: env: - DATABASE=sqlite - - DATABASE=postgres - - DATABASE=mssql - - DATABASE=mysql + # - DATABASE=postgres + # - DATABASE=mssql + # - DATABASE=mysql services: - docker @@ -33,7 +33,7 @@ install: - pip install --no-cache-dir mkdocs==1.1 mkdocs-material==4.6.3 script: - - docker build --target=builder --tag=doccano-test . + - docker build --target=runtime --tag=doccano-test . - > if [[ "${DATABASE}" != "sqlite" ]]; then docker run --network doccano -e DATABASE_URL="${DATABASE_URL}" -it doccano-test sh -c 'app/manage.py wait_for_db && app/manage.py migrate && app/manage.py test api.tests server.tests' diff --git a/Dockerfile b/Dockerfile index 0638fc6e..6ac3c7a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,61 +1,49 @@ -ARG PYTHON_VERSION="3.6" -FROM python:${PYTHON_VERSION}-stretch AS builder - -SHELL ["/bin/bash", "-o", "pipefail", "-c"] - -ARG NODE_VERSION="8.x" -# hadolint ignore=DL3008 -RUN curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}" | bash - \ - && apt-get install --no-install-recommends -y \ - nodejs - -ARG HADOLINT_VERSION=v1.17.1 -RUN curl -fsSL "https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-Linux-$(uname -m)" -o /usr/local/bin/hadolint \ - && chmod +x /usr/local/bin/hadolint - -COPY tools/install-mssql.sh /doccano/tools/install-mssql.sh -RUN /doccano/tools/install-mssql.sh --dev - -COPY app/server/static/package*.json /doccano/app/server/static/ -WORKDIR /doccano/app/server/static -RUN npm ci - -COPY requirements.txt / -RUN pip install --no-cache-dir -r /requirements.txt \ +ARG PYTHON_VERSION="3.8.6" +ARG NODE_VERSION="13.7" +FROM node:${NODE_VERSION}-alpine AS frontend-builder + +COPY frontend/ /frontend/ +WORKDIR /frontend +ENV PUBLIC_PATH="/static/_nuxt/" + +# hadolint ignore=DL3018 +RUN apk add -U --no-cache git python3 make g++ \ + && yarn install \ + && yarn build \ + && apk del --no-cache git make g++ + +FROM python:${PYTHON_VERSION}-slim-buster AS backend-builder + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + netcat=1.10-41.1 \ + libpq-dev=11.9-0+deb10u1 \ + unixodbc-dev=2.3.6-0.1 \ + g++=4:8.3.0-1 \ + && apt-get clean + +COPY /app/requirements.txt / +# hadolint ignore=DL3013 +RUN pip install --no-cache-dir -U pip \ + && pip install --no-cache-dir -r /requirements.txt \ && pip wheel --no-cache-dir -r /requirements.txt -w /deps -COPY Dockerfile / -RUN hadolint /Dockerfile - -COPY . /doccano - -WORKDIR /doccano -RUN tools/ci.sh - -FROM builder AS cleaner - -WORKDIR /doccano/app/server/static -RUN SOURCE_MAP=False DEBUG=False npm run build \ - && rm -rf components pages node_modules .*rc package*.json webpack.config.js - -WORKDIR /doccano -RUN python app/manage.py collectstatic --noinput - -FROM python:${PYTHON_VERSION}-slim-stretch AS runtime - -COPY --from=builder /doccano/tools/install-mssql.sh /doccano/tools/install-mssql.sh -RUN /doccano/tools/install-mssql.sh +FROM python:${PYTHON_VERSION}-slim-buster AS runtime RUN useradd -ms /bin/sh doccano RUN mkdir /data \ && chown doccano:doccano /data -COPY --from=builder /deps /deps +COPY --from=backend-builder /deps /deps # hadolint ignore=DL3013 -RUN pip install --no-cache-dir /deps/*.whl +RUN pip install --no-cache-dir -U pip \ + && pip install --no-cache-dir /deps/*.whl -COPY --from=cleaner --chown=doccano:doccano /doccano /doccano +COPY --chown=doccano:doccano . /doccano +WORKDIR /doccano +COPY --from=frontend-builder /frontend/dist /doccano/app/client/dist +RUN python app/manage.py collectstatic --noinput VOLUME /data ENV DATABASE_URL="sqlite:////data/doccano.db" diff --git a/app/app/settings.py b/app/app/settings.py index a204a563..1163ddbb 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -92,7 +92,7 @@ ROOT_URLCONF = 'app.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [path.join(BASE_DIR, 'server/templates'), path.join(BASE_DIR, 'authentification/templates')], + 'DIRS': [path.join(BASE_DIR, 'client/dist')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -118,12 +118,7 @@ STATIC_URL = '/static/' STATIC_ROOT = path.join(BASE_DIR, 'staticfiles') STATICFILES_DIRS = [ - static_path - for static_path in ( - path.join(BASE_DIR, 'server', 'static', 'assets'), - path.join(BASE_DIR, 'server', 'static', 'static'), - ) - if path.isdir(static_path) + path.join(BASE_DIR, 'client/dist/static'), ] STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' diff --git a/app/app/urls.py b/app/app/urls.py index a71ac815..29825767 100644 --- a/app/app/urls.py +++ b/app/app/urls.py @@ -15,12 +15,11 @@ Including another URLconf """ from django.conf import settings from django.contrib import admin -from django.urls import path, include -from django.contrib.auth.views import PasswordResetView, LogoutView +from django.urls import path, include, re_path +from django.contrib.auth.views import TemplateView from drf_yasg.views import get_schema_view from drf_yasg import openapi -from server.views import LoginView # TODO: adds AnnotationList and AnnotationDetail endpoint. schema_view = get_schema_view( @@ -34,16 +33,12 @@ schema_view = get_schema_view( ) urlpatterns = [ - path('', include('authentification.urls')), - path('', include('server.urls')), path('admin/', admin.site.urls), path('social/', include('social_django.urls')), - path('login/', LoginView.as_view(), name='login'), - path('logout/', LogoutView.as_view(), name='logout'), - path('password_reset/', PasswordResetView.as_view(), name='password_reset'), path('api-auth/', include('rest_framework.urls')), path('v1/', include('api.urls')), path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), + re_path('', TemplateView.as_view(template_name='index.html')), ] if 'cloud_browser' in settings.INSTALLED_APPS: diff --git a/app/requirements.txt b/app/requirements.txt index 789ec599..615bdf9e 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -26,7 +26,7 @@ furl==2.0.0 gunicorn==19.9.0 lockfile==0.12.2 model-mommy==1.6.0 -psycopg2-binary==2.7.7 +psycopg2-binary==2.8.6 pyexcel==0.5.14 pyexcel-xlsx==0.5.7 python-dateutil==2.7.3 diff --git a/frontend/assets/README.md b/frontend/assets/README.md deleted file mode 100644 index 34766f93..00000000 --- a/frontend/assets/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# ASSETS - -**This directory is not required, you can delete it if you don't want to use it.** - -This directory contains your un-compiled assets such as LESS, SASS, or JavaScript. - -More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked). diff --git a/frontend/assets/feature1.png b/frontend/assets/feature1.png new file mode 100644 index 00000000..b4745afb Binary files /dev/null and b/frontend/assets/feature1.png differ diff --git a/frontend/assets/feature2.png b/frontend/assets/feature2.png new file mode 100644 index 00000000..b30f9ce0 Binary files /dev/null and b/frontend/assets/feature2.png differ diff --git a/frontend/assets/feature3.png b/frontend/assets/feature3.png new file mode 100644 index 00000000..ea9cf509 Binary files /dev/null and b/frontend/assets/feature3.png differ diff --git a/frontend/assets/ner_demo.png b/frontend/assets/ner_demo.png new file mode 100644 index 00000000..311b3bb3 Binary files /dev/null and b/frontend/assets/ner_demo.png differ diff --git a/frontend/assets/style/app.styl b/frontend/assets/style/app.styl deleted file mode 100644 index dbb26799..00000000 --- a/frontend/assets/style/app.styl +++ /dev/null @@ -1,2 +0,0 @@ -// Import Vuetify styling -@require '~vuetify/src/stylus/app.styl' diff --git a/frontend/assets/style/variables.styl b/frontend/assets/style/variables.styl deleted file mode 100644 index 8a26685a..00000000 --- a/frontend/assets/style/variables.styl +++ /dev/null @@ -1 +0,0 @@ -@require '~vuetify/src/stylus/settings/_variables.styl' diff --git a/frontend/assets/vbanner.jpg b/frontend/assets/vbanner.jpg new file mode 100644 index 00000000..4a77ca23 Binary files /dev/null and b/frontend/assets/vbanner.jpg differ diff --git a/frontend/components/organisms/layout/FeatureCards.vue b/frontend/components/organisms/layout/FeatureCards.vue index 2b2b5f9f..552a11ac 100644 --- a/frontend/components/organisms/layout/FeatureCards.vue +++ b/frontend/components/organisms/layout/FeatureCards.vue @@ -23,7 +23,7 @@ md4 > @@ -47,17 +47,17 @@ export default { return { featureCards: [ { - imageSrc: '/images/feature3.png', + imageSrc: 'feature3.png', title: this.$t('home.featuresTitle1'), text: this.$t('home.featuresText1') }, { - imageSrc: '/images/feature2.png', + imageSrc: 'feature2.png', title: this.$t('home.featuresTitle2'), text: this.$t('home.featuresText2') }, { - imageSrc: '/images/feature1.png', + imageSrc: 'feature1.png', title: this.$t('home.featuresTitle3'), text: this.$t('home.featuresText3') } diff --git a/frontend/components/organisms/layout/TheBottomBanner.vue b/frontend/components/organisms/layout/TheBottomBanner.vue index 0c498178..139317c3 100644 --- a/frontend/components/organisms/layout/TheBottomBanner.vue +++ b/frontend/components/organisms/layout/TheBottomBanner.vue @@ -1,7 +1,7 @@