Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Dec 7, 2023
0 parents commit f74752c
Show file tree
Hide file tree
Showing 1,094 changed files with 283,339 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
**/.git
**/.gitignore
**/.github
**/.vscode
**/.idea
**/coverage
**/.aws
**/.ssh
**/.DS_Store
**/.aof
**/venv
**/env
**/bin
# **/docs we want to keep dje/templates/rest_framework/docs/
docs/
# **/dist we want to keep ./thirdparty/dist/
# **/etc we need to keep ./etc/
**/lib
**/include
**/share
**/var
**/*.egg-info
**/*.log
**/__pycache__
*.pyc
.dockerignore
.readthedocs.yaml
docker.env
.env
Makefile
Dockerfile
README.rst
docker-compose.yml
fabfile.py
pyvenv.cfg
17 changes: 17 additions & 0 deletions .github/workflows/ci-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Test on Docker CI

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Generate the .env file and the SECRET_KEY
run: make envfile

- name: Run tests
run: docker compose run web python ./manage.py test --verbosity=2 --noinput
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Test CI

on: [push, pull_request]

env:
DATABASE_NAME: dejacode
DATABASE_USER: dejacode
DATABASE_PASSWORD: dejacode
POSTGRES_INITDB_ARGS: --encoding=UTF-8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8

jobs:
test:
runs-on: ubuntu-22.04

services:
postgres:
image: postgres:16
env:
POSTGRES_DB: ${{ env.DATABASE_NAME }}
POSTGRES_USER: ${{ env.DATABASE_USER }}
POSTGRES_PASSWORD: ${{ env.DATABASE_PASSWORD }}
POSTGRES_INITDB_ARGS: ${{ env.POSTGRES_INITDB_ARGS }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install python-ldap OS dependencies
run: sudo apt-get install -y libsasl2-dev libldap2-dev libssl-dev

- name: Install dependencies
run: make dev envfile

- name: Validate code format
run: make check

- name: Start Redis
uses: supercharge/[email protected]

# - name: Check Django deployment settings
# run: make check-deploy

- name: Build the documentation
run: make docs

- name: Run tests
run: bin/python manage.py test --verbosity=2 --noinput --parallel
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
*.pyc
*.db
.installed.cfg
parts
develop-eggs
bin
eggs
downloads
lib
lib64
build
.project
.pydevproject
include
.settings
TAGS
.idea
Include
Lib
.env
Procfile
tmp
var
.Python
local.cfg
_build
pip-selfcheck.json
pyvenv.cfg
geckodriver.log
.DS_Store
share
selenium
local
/dejacode.egg-info/
/dist/
/.cache/
/.python-version
/enterprise.egg-info/
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Release notes
=============

### Version 5.0.0
6 changes: 6 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
========================
Contributing to DejaCode
========================

Documented at https://dejacode.readthedocs.io/en/latest/contributing.html
or in docs/contributing.rst for details.
63 changes: 63 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# DejaCode is a trademark of nexB Inc.
# SPDX-License-Identifier: AGPL-3.0-only
# See https://github.com/nexB/dejacode for support or download.
# See https://aboutcode.org for more information about AboutCode FOSS projects.
#

FROM python:3.10-slim

LABEL org.opencontainers.image.source="https://github.com/nexB/dejacode"
LABEL org.opencontainers.image.description="DejaCode"
LABEL org.opencontainers.image.licenses="AGPL-3.0-only"

ENV APP_NAME dejacode
ENV APP_USER app
ENV APP_DIR /opt/$APP_NAME
ENV VIRTUAL_ENV /opt/$APP_NAME/venv

# Force Python unbuffered stdout and stderr (they are flushed to terminal immediately)
ENV PYTHONUNBUFFERED 1
# Do not write Python .pyc files
ENV PYTHONDONTWRITEBYTECODE 1
# Add the app dir in the Python path for entry points availability
ENV PYTHONPATH $PYTHONPATH:$APP_DIR

# OS requirements
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libldap2-dev \
libsasl2-dev \
libpq5 \
wait-for-it \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Create the APP_USER group, user, and directory with proper permissions
RUN addgroup --system $APP_USER \
&& adduser --system --group --home=$APP_DIR $APP_USER \
&& chown $APP_USER:$APP_USER $APP_DIR \
&& mkdir -p /var/$APP_NAME \
&& chown $APP_USER:$APP_USER /var/$APP_NAME

# Setup the work directory and the user as APP_USER for the remaining stages
WORKDIR $APP_DIR
USER $APP_USER

# Create directories for static and media files
RUN mkdir -p /var/$APP_NAME/static/ /var/$APP_NAME/media/

# Create the virtualenv
RUN python -m venv $VIRTUAL_ENV
# Enable the virtualenv, similar effect as "source activate"
ENV PATH $VIRTUAL_ENV/bin:$PATH

# Install the dependencies before the codebase COPY for proper Docker layer caching
COPY --chown=$APP_USER:$APP_USER setup.cfg setup.py $APP_DIR/
COPY --chown=$APP_USER:$APP_USER ./thirdparty/dist/ $APP_DIR/thirdparty/dist/
RUN pip install --find-links=$APP_DIR/thirdparty/dist/ --no-index --no-cache-dir .

# Copy the codebase and set the proper permissions for the APP_USER
COPY --chown=$APP_USER:$APP_USER . $APP_DIR
Loading

0 comments on commit f74752c

Please sign in to comment.