Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
dudanogueira committed Jun 29, 2022
2 parents 5746a7b + 7e2d835 commit 2cfafa1
Show file tree
Hide file tree
Showing 39 changed files with 1,403 additions and 445 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'dev'
tags:
- 'v*'

pull_request:
branches:
- 'master'
Expand Down Expand Up @@ -39,4 +39,4 @@ jobs:
file: ./compose/production/django/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}
29 changes: 20 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
exclude: 'docs|node_modules|migrations|.git|.tox|emojipy|.dot'
exclude: '^docs/|/migrations/|node_modules|migrations|.git|.tox|emojipy|.dot|emojipy'
default_stages: [commit]
fail_fast: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml

- repo: https://github.com/asottile/pyupgrade
rev: v2.32.1
hooks:
- id: pyupgrade
args: [--py39-plus]

- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.3.0
hooks:
- id: black

- repo: https://github.com/timothycrosley/isort
rev: 5.7.0
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args: ['--config=setup.cfg']
args: ["--config=setup.cfg"]
additional_dependencies: [flake8-isort]

# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
ci:
autoupdate_schedule: weekly
skip: []
submodules: false
66 changes: 52 additions & 14 deletions compose/local/django/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,63 @@
FROM python:3.8-slim-buster
ARG PYTHON_VERSION=3.9-slim-bullseye

ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
# define an alias for the specfic python version used in this file.
FROM python:${PYTHON_VERSION} as python

# Python build stage
FROM python as python-build-stage

RUN apt-get update \
ARG BUILD_ENVIRONMENT=local

# Install apt packages
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
&& apt-get install -y build-essential python3-dev \
build-essential \
# psycopg2 dependencies
&& apt-get install -y libpq-dev \
# Translations dependencies
&& apt-get install -y gettext \
libpq-dev \
# QR TOOLS
&& apt-get install -y libzbar0 libzbar-dev \
&& apt install -y libzbar0 libzbar-dev python3-zbar \
# misc dependencies
&& apt-get install -y curl \
&& apt-get install -y curl

# Requirements are installed here to ensure they will be cached.
COPY ./requirements .

# Create Python Dependency and Sub-Dependency Wheels.
RUN pip wheel --wheel-dir /usr/src/app/wheels \
-r ${BUILD_ENVIRONMENT}.txt


# Python 'run' stage
FROM python as python-run-stage

ARG BUILD_ENVIRONMENT=local
ARG APP_HOME=/app

ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV BUILD_ENV ${BUILD_ENVIRONMENT}

WORKDIR ${APP_HOME}

# Install required system dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
# psycopg2 dependencies
libpq-dev \
# Translations dependencies
# qrcode deps \
python3-zbar \
gettext \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*

# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt
# All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction
# copy python dependency wheels from python-build-stage
COPY --from=python-build-stage /usr/src/app/wheels /wheels/

# use wheels to install python dependencies
RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \
&& rm -rf /wheels/

COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint
Expand All @@ -42,6 +79,7 @@ COPY ./compose/local/django/celery/flower/start /start-flower
RUN sed -i 's/\r$//g' /start-flower
RUN chmod +x /start-flower

WORKDIR /app
# copy application code to WORKDIR
COPY . ${APP_HOME}

ENTRYPOINT ["/entrypoint"]
80 changes: 58 additions & 22 deletions compose/local/docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,69 @@
FROM python:3.8-slim-buster
ARG PYTHON_VERSION=3.9-slim-bullseye

# define an alias for the specfic python version used in this file.
FROM python:${PYTHON_VERSION} as python


# Python build stage
FROM python as python-build-stage

ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1

RUN apt-get update \
# dependencies for building Python packages
&& apt-get install -y build-essential python3-dev \
# psycopg2 dependencies
&& apt-get install -y libpq-dev \
# QR TOOLS
&& apt-get install -y libzbar0 libzbar-dev \
# Translations dependencies
&& apt-get install -y gettext \
# Uncomment below lines to enable Sphinx output to latex and pdf
# && apt-get install -y texlive-latex-recommended \
# && apt-get install -y texlive-fonts-recommended \
# && apt-get install -y texlive-latex-extra \
# && apt-get install -y latexmk \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
# psycopg2 dependencies
libpq-dev \
# QR TOOLS
&& apt install -y libzbar0 libzbar-dev python3-zbar \
# misc dependencies
&& apt-get install -y curl \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*

# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
# All imports needed for autodoc.
RUN pip install -r /requirements/local.txt -r /requirements/production.txt

# create python dependency wheels
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels \
-r /requirements/local.txt -r /requirements/production.txt \
&& rm -rf /requirements


# Python 'run' stage
FROM python as python-run-stage

ARG BUILD_ENVIRONMENT
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1

RUN apt-get update && apt-get install --no-install-recommends -y \
# To run the Makefile
make \
# psycopg2 dependencies
libpq-dev \
# Translations dependencies
gettext \
# Uncomment below lines to enable Sphinx output to latex and pdf
texlive-latex-recommended \
texlive-fonts-recommended \
texlive-latex-extra \
latexmk \
python3-zbar \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*

# copy python dependency wheels from python-build-stage
COPY --from=python-build-stage /usr/src/app/wheels /wheels

# use wheels to install python dependencies
RUN pip install --no-cache /wheels/* \
&& rm -rf /wheels

COPY ./compose/local/docs/start /start-docs
RUN sed -i 's/\r$//g' /start-docs
RUN chmod +x /start-docs

WORKDIR /docs
WORKDIR /docs
1 change: 1 addition & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"rest_framework",
"rest_framework.authtoken",
"corsheaders",
"fontawesomefree",
]

LOCAL_APPS = [
Expand Down
3 changes: 3 additions & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
path("accounts/", include("allauth.urls")),
path("instance/", include("rocket_connect.instance.urls", namespace="instance")),
# Your stuff: custom urls includes go here
re_path(
r"^connector/(?P<connector_id>\w+)/inbound/?$", views.connector_inbound_endpoint
),
re_path(r"^connector/(?P<connector_id>\w+)/?$", views.connector_endpoint),
re_path(r"^server/(?P<server_id>\w+)/?$", views.server_endpoint),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Expand Down
Loading

0 comments on commit 2cfafa1

Please sign in to comment.