Skip to content

Commit 1fd5c73

Browse files
authored
add devcontainer
1 parent ef7696d commit 1fd5c73

File tree

6 files changed

+122
-1
lines changed

6 files changed

+122
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Note: You can use any Debian/Ubuntu based image you want.
2+
FROM mcr.microsoft.com/devcontainers/python:3.7-bullseye
3+
4+
RUN \
5+
apt update && \
6+
apt-get install bash-completion graphviz default-mysql-client -y
7+
8+
ENV DJ_HOST localhost
9+
ENV DJ_USER root
10+
ENV DJ_PASS simple

.devcontainer/devcontainer.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
{
3+
"name": "Development",
4+
"dockerComposeFile": "docker-compose.yaml",
5+
"service": "app",
6+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
7+
// Use this environment variable if you need to bind mount your local source code into a new container.
8+
"remoteEnv": {
9+
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
10+
},
11+
// https://containers.dev/features
12+
"features": {
13+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
14+
"ghcr.io/devcontainers/features/git:1": {},
15+
"ghcr.io/eitsupi/devcontainer-features/jq-likes:1": {},
16+
"ghcr.io/guiyomh/features/vim:0": {}
17+
},
18+
"onCreateCommand": "pip install flake8 black faker ipykernel datajoint",
19+
"postStartCommand": "MYSQL_VER=8.0 MINIO_VER=RELEASE.2022-08-11T04-37-28Z docker compose -f ./.devcontainer/local-docker-compose.yml down && MYSQL_VER=8.0 MINIO_VER=RELEASE.2022-08-11T04-37-28Z docker compose -f ./.devcontainer/local-docker-compose.yml up --build --wait",
20+
"forwardPorts": [
21+
80,
22+
443,
23+
3306,
24+
8080,
25+
9000
26+
],
27+
"customizations": {
28+
"vscode": {
29+
"extensions": [
30+
"ms-python.python"
31+
]
32+
}
33+
}
34+
}

.devcontainer/docker-compose.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "3"
2+
services:
3+
app:
4+
build: .
5+
extra_hosts:
6+
- fakeservices.datajoint.io:127.0.0.1
7+
volumes:
8+
- ../..:/workspaces:cached
9+
entrypoint: /usr/local/share/docker-init.sh
10+
command: tail -f /dev/null
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# MYSQL_VER=5.7 MINIO_VER=RELEASE.2022-08-11T04-37-28Z docker compose -f local-docker-compose.yml up --build
2+
version: "2.4"
3+
x-net:
4+
&net
5+
networks:
6+
- main
7+
services:
8+
db:
9+
<<: *net
10+
image: datajoint/mysql:${MYSQL_VER}
11+
environment:
12+
- MYSQL_ROOT_PASSWORD=${DJ_PASS}
13+
# ports:
14+
# - "3306:3306"
15+
# To persist MySQL data
16+
# volumes:
17+
# - ./mysql/data:/var/lib/mysql
18+
healthcheck:
19+
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
20+
timeout: 30s
21+
retries: 5
22+
interval: 15s
23+
minio:
24+
<<: *net
25+
image: minio/minio:${MINIO_VER}
26+
environment:
27+
- MINIO_ACCESS_KEY=datajoint
28+
- MINIO_SECRET_KEY=datajoint
29+
# ports:
30+
# - "9000:9000"
31+
# To persist MinIO data and config
32+
# volumes:
33+
# - ./minio/data:/data
34+
# - ./minio/config:/root/.minio
35+
command: server --address ":9000" /data
36+
healthcheck:
37+
test:
38+
[
39+
"CMD",
40+
"curl",
41+
"--fail",
42+
"http://minio:9000/minio/health/live"
43+
]
44+
timeout: 30s
45+
retries: 5
46+
interval: 15s
47+
fakeservices.datajoint.io:
48+
<<: *net
49+
image: datajoint/nginx:v0.2.4
50+
environment:
51+
- ADD_db_TYPE=DATABASE
52+
- ADD_db_ENDPOINT=db:3306
53+
- ADD_minio_TYPE=MINIO
54+
- ADD_minio_ENDPOINT=minio:9000
55+
- ADD_minio_PORT=80 # allow unencrypted connections
56+
- ADD_minio_PREFIX=/datajoint
57+
- ADD_browser_TYPE=MINIOADMIN
58+
- ADD_browser_ENDPOINT=minio:9000
59+
- ADD_browser_PORT=80 # allow unencrypted connections
60+
ports:
61+
- "80:80"
62+
- "443:443"
63+
- "3306:3306"
64+
- "9000:9000"
65+
networks:
66+
main:

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# playground_tutorial
1+
# DataJoint interactive tutorial
22
Getting started materials for DataJoint - with Calcium Imaging, Electrophysiology, Machine Learning examples
3+

tutorial_pipeline/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)