Skip to content

Commit

Permalink
Merge pull request #250 from datamade/add-wagtail-cookiecutter
Browse files Browse the repository at this point in the history
Implemented wagtail cookiecutter
  • Loading branch information
antidipyramid authored Nov 30, 2022
2 parents 375a67a + 558c7ad commit ab96e78
Show file tree
Hide file tree
Showing 69 changed files with 2,818 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added docker/.DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions docker/templates/new-wagtail-app/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"app_name": "new-project",
"module_name": "project",
"app_verbose_name": "Site Name"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
globals: {
__PATH_PREFIX__: true,
},
extends: `react-app`,
rules: {
"indent": ["error", 2],
"no-console": "off",
"strict": ["error", "global"],
"curly": "warn",
"semi": ["error", "never"],
"space-in-parens": ["error", "never"],
"space-before-function-paren": ["error", "always"],
"space-before-blocks": ["error", "always"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Overview

Brief description of what this PR does, and why it is needed.

Closes #XXX

### Demo

Optional. Screenshots, `curl` examples, etc.

### Notes

Optional. Ancillary topics, caveats, alternative strategies that didn't work out, anything else.

## Testing Instructions

* How to test this PR
* Prefer bulleted description
* Start after checking out this branch
* Include any setup required, such as bundling scripts, restarting services, etc.
* Include test case, and expected output
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI

on:
push:
branches:
- main
- deploy
pull_request:
branches:
- main

jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- shell: bash
run: |
cp .env.example .env
- name: Build containers and run tests
run: docker-compose -f docker-compose.yml -f tests/docker-compose.yml run --rm app
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish Docker image
on:
workflow_dispatch:
jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: {% raw %}${{ github.actor }}{% endraw %}
password: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
- name: Push to GitHub Packages
uses: docker/build-push-action@v2
with:
push: true
tags: ghcr.io/{% raw %}${{ github.repository }}{% endraw %}:latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
.DS_Store

out.txt
/data/final/*.csv
/data/shapefiles/*
/data/intermediate/*.sql

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# Compiled JavaScript
node_modules/
efi/static/compressor/*
!efi/static/js/lib/

# Local uploads
media/
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Extend the base Python image
# See https://hub.docker.com/_/python for version options
# N.b., there are many options for Python images. We used the plain
# version number in the pilot. YMMV. See this post for a discussion of
# some options and their pros and cons:
# https://pythonspeed.com/articles/base-image-python-docker-images/
FROM python:3.9

# Give ourselves some credit
LABEL maintainer "DataMade <[email protected]>"

# Add the NodeSource PPA
# (see: https://github.com/nodesource/distributions/blob/master/README.md)
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -

# Install any additional OS-level packages you need via apt-get. RUN statements
# add additional layers to your image, increasing its final size. Keep your
# image small by combining related commands into one RUN statement, e.g.,
#
RUN apt-get update && \
apt-get install -y --no-install-recommends gettext postgresql-client nodejs gdal-bin postgis
#
# Read more on Dockerfile best practices at the source:
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices
# RUN apt-get install -y --no-install-recommends postgresql-client nodejs gdal-bin

# Inside the container, create an app directory and switch into it
RUN mkdir /app
WORKDIR /app

# Copy the requirements file into the app directory, and install them. Copy
# only the requirements file, so Docker can cache this build step. Otherwise,
# the requirements must be reinstalled every time you build the image after
# the app code changes. See this post for further discussion of strategies
# for building lean and efficient containers:
# https://blog.realkinetic.com/building-minimal-docker-containers-for-python-applications-37d0272c52f3
COPY ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Install Node requirements
COPY ./package.json /app/package.json
RUN npm install

# Copy the contents of the current host directory (i.e., our app code) into
# the container.
COPY . /app

# Add a bogus env var for the Django secret key in order to allow us to run
# the 'collectstatic' management command
ENV DJANGO_SECRET_KEY 'foobar'
# Add a bogus env var for Debug to make sure that Django compressor can run
ENV DJANGO_DEBUG 'False'

# Build static files into the container
RUN python manage.py collectstatic --noinput
RUN python manage.py compress
Loading

0 comments on commit ab96e78

Please sign in to comment.