Add dev container
Setup Visual Studio Code devcontainer with symposion app and postgresql database for easier local development. Upgrade to Debian Bookworm for base container.
This commit is contained in:
parent
0bd1417f04
commit
fb3fcc2faa
9 changed files with 115 additions and 5 deletions
24
.devcontainer/Dockerfile
Normal file
24
.devcontainer/Dockerfile
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
FROM mcr.microsoft.com/devcontainers/python:1-3.8-bookworm
|
||||
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# Install additional OS packages.
|
||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
&& apt-get -y install --no-install-recommends \
|
||||
libffi-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg-dev \
|
||||
libwebp-dev \
|
||||
libpng-dev \
|
||||
liblcms2-dev \
|
||||
zlib1g-dev \
|
||||
libmemcached-dev \
|
||||
libsasl2-dev \
|
||||
inkscape \
|
||||
xmlsec1
|
||||
|
||||
# Install our requirements now, as they rarely change.
|
||||
COPY constraints.txt requirements.txt /tmp/pip-tmp/
|
||||
RUN pip3 install -U pip \
|
||||
&& pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt -c /tmp/pip-tmp/constraints.txt \
|
||||
&& rm -rf /tmp/pip-tmp
|
||||
33
.devcontainer/devcontainer.json
Normal file
33
.devcontainer/devcontainer.json
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
|
||||
{
|
||||
"name": "Conference Website",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"workspaceFolder": "/workspace",
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
"features": {
|
||||
// "ghcr.io/devcontainers/features/python:1": {
|
||||
// "installTools": true,
|
||||
// "version": "3.12"
|
||||
// }
|
||||
},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
"forwardPorts": [8000],
|
||||
|
||||
// Uncomment the next line to run commands after the container is created.
|
||||
"postCreateCommand": ".devcontainer/post-create.sh",
|
||||
|
||||
// Ensure the workspace directory is marked as safe for git operations.
|
||||
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
// NOTE: Need to use "root" when using rootless docker on linux.
|
||||
"remoteUser": "root",
|
||||
"containerUser": "root"
|
||||
}
|
||||
45
.devcontainer/docker-compose.yml
Normal file
45
.devcontainer/docker-compose.yml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Docker Compose setup for developing Symposion/Registrasion/RegiDesk
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
|
||||
environment:
|
||||
DATABASE_URL: postgres://postgres:postgres@db:5432/postgres
|
||||
DJANGO_SECRET_KEY: 5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B
|
||||
STRIPE_PUBLIC_KEY: 5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B
|
||||
STRIPE_SECRET_KEY: 5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B
|
||||
GCS_BUCKET: 5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B
|
||||
GOOGLE_APPLICATION_CREDENTIALS: /dev/null
|
||||
SYMPOSION_DEV_MODE: LAPTOP
|
||||
SYMPOSION_APP_DEBUG: 1
|
||||
|
||||
volumes:
|
||||
- ../:/workspace:cached
|
||||
|
||||
# Overrides default command so things don't shut down after the process ends.
|
||||
command: sleep infinity
|
||||
|
||||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
|
||||
network_mode: service:db
|
||||
|
||||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
|
||||
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||
|
||||
db:
|
||||
image: postgres:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
|
||||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
|
||||
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
6
.devcontainer/post-create.sh
Executable file
6
.devcontainer/post-create.sh
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
pip install --user -r requirements.txt -c constraints.txt
|
||||
pip install --user -c constraints.txt -e vendor/registrasion
|
||||
pip install --user -c constraints.txt -e vendor/registripe
|
||||
pip install --user -c constraints.txt -e vendor/regidesk
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
FROM python:3.8-buster as symposion_base
|
||||
FROM python:3.8-bookworm as symposion_base
|
||||
|
||||
RUN set -ex \
|
||||
&& apt-get update
|
||||
|
|
@ -14,8 +14,9 @@ RUN set -ex \
|
|||
libmemcached-dev \
|
||||
libsasl2-dev \
|
||||
inkscape \
|
||||
xmlsec1 \
|
||||
' \
|
||||
&& apt-get install -y git xmlsec1 \
|
||||
&& apt-get install -y git \
|
||||
&& apt-get install -y $buildDeps --no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/usr/local/bin/python /app/symposion_app/manage.py migrate
|
||||
/usr/local/bin/python /app/symposion_app/manage.py loaddata /app/symposion_app/fixtures/{conference,sites,sitetree,flatpages}.json
|
||||
/usr/local/bin/python /app/symposion_app/manage.py create_review_permissions
|
||||
/usr/local/bin/python /app/symposion_app/manage.py loaddata /app/symposion_app/fixtures/????/*.json
|
||||
/usr/local/bin/python /app/symposion_app/manage.py loaddata /app/symposion_app/fixtures/sessions/*.json
|
||||
#/usr/local/bin/python /app/symposion_app/manage.py populate_inventory
|
||||
|
||||
if [ -e /configs/auth/auth.json ]; then
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ django-waffle==2.0.0
|
|||
|
||||
# database
|
||||
mysqlclient==2.0.1
|
||||
psycopg2==2.8.6
|
||||
|
||||
# For testing
|
||||
django-nose==1.4.7
|
||||
|
|
|
|||
2
vendor/regidesk/requirements.txt
vendored
2
vendor/regidesk/requirements.txt
vendored
|
|
@ -1,4 +1,4 @@
|
|||
django-countries>=6.1.3
|
||||
django-countries==7.3.2
|
||||
requests>=2.24.0
|
||||
pypng
|
||||
pyqrcode
|
||||
|
|
|
|||
2
vendor/registripe/requirements.txt
vendored
2
vendor/registripe/requirements.txt
vendored
|
|
@ -1,4 +1,4 @@
|
|||
django-countries>=6.1.3
|
||||
django-countries==7.3.2
|
||||
pinax-stripe==4.4.0
|
||||
requests>=2.24.0
|
||||
stripe==2.55.0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue