Skip to content

Commit

Permalink
Add devcontainer support to core (#12391)
Browse files Browse the repository at this point in the history
To test, open the folder in VSCode and follow the prompts (if you have remote container support installed, you should be asked to switch to remote development).
  • Loading branch information
patrys committed Mar 24, 2023
1 parent 59c8d62 commit 1353532
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .devcontainer/backend.env
@@ -0,0 +1,5 @@
DATABASE_URL=postgres://saleor:saleor@db/saleor
DASHBOARD_URL=http://localhost:9000/
DEFAULT_FROM_EMAIL=noreply@example.com
CELERY_BROKER_URL=redis://redis:6379/1
SECRET_KEY=changeme
1 change: 1 addition & 0 deletions .devcontainer/common.env
@@ -0,0 +1 @@
DEFAULT_CHANNEL_SLUG=default-channel
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
@@ -0,0 +1,24 @@
{
"name": "Saleor",
"dockerComposeFile": "docker-compose.yml",
"service": "saleor",
"workspaceFolder": "/app",
"forwardPorts": [8000],
"postCreateCommand": "python manage.py migrate",
"customizations": {
"vscode": {
"extensions": [
"Cameron.vscode-pytest",
"charliermarsh.ruff",
"editorconfig.editorconfig",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.isort",
"ms-python.pylint",
"ms-python.python",
"ms-python.vscode-pylance",
"streetsidesoftware.code-spell-checker"
]
}
}
}
56 changes: 56 additions & 0 deletions .devcontainer/docker-compose.yml
@@ -0,0 +1,56 @@
version: "3.4"

services:
saleor:
image: saleor
build:
context: ..
dockerfile: ./Dockerfile
command: ["python", "-m", "saleor"]
env_file:
- common.env
- backend.env

dashboard:
image: ghcr.io/saleor/saleor-dashboard:3.12.3
ports:
- 9000:80
restart: unless-stopped

db:
image: library/postgres:13-alpine
restart: unless-stopped
volumes:
- saleor-db:/var/lib/postgresql/data
environment:
- POSTGRES_USER=saleor
- POSTGRES_PASSWORD=saleor

redis:
image: library/redis:5.0-alpine
restart: unless-stopped
volumes:
- saleor-redis:/data

worker:
image: saleor
build:
context: ..
dockerfile: ./Dockerfile
command: celery -A saleor --app=saleor.celeryconf:app worker --loglevel=info -B
restart: unless-stopped
env_file:
- common.env
- backend.env
depends_on:
- redis
volumes:
# shared volume between worker and api for media
- saleor-media:/app/media

volumes:
saleor-db:
driver: local
saleor-redis:
driver: local
saleor-media:
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
*.py[cod]
.*
!.devcontainer
!.dockerignore
!.github
!.gitignore
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -18,6 +18,7 @@ All notable, unreleased changes to this project will be documented in this file.

### Other changes
- Create order discounts for all voucher types - #12272 by @IKarbowiak
- Core now supports Dev Containers for local development - #12391 by @patrys

### Saleor Apps

Expand Down

0 comments on commit 1353532

Please sign in to comment.