Skip to content

Commit

Permalink
Add nosetests and mysql to dev container
Browse files Browse the repository at this point in the history
  • Loading branch information
ethho committed Dec 4, 2023
1 parent 2228807 commit 92f6d6e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 13 deletions.
13 changes: 13 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG PY_VER
ARG DISTRO
FROM mcr.microsoft.com/devcontainers/python:${PY_VER}-${DISTRO}
RUN \
apt update && \
apt-get install bash-completion graphviz default-mysql-client -y && \
pip install flake8 black faker ipykernel pytest pytest-cov nose nose-cov datajoint && \
pip uninstall datajoint -y

USER root
ENV DJ_HOST fakeservices.datajoint.io
ENV DJ_USER root
ENV DJ_PASS password
26 changes: 20 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,32 @@
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
"forwardPorts": [
80,
443,
3306,
8080,
9000
],
// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
"shutdownAction": "stopCompose",
// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "python3 -m pip install -e .",
"onCreateCommand": "python3 -m pip install -e .",
"features": {
"ghcr.io/cirolosapio/devcontainers-features/alpine-git:0": {},
"ghcr.io/devcontainers/features/git:1": {},
},
// Configure tool-specific properties.
// "customizations": {},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
]
}
},
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
}
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
}
18 changes: 11 additions & 7 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ version: '2.4'
services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
app:
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
# array). The sample below assumes your primary file is in the root of your project.
#
# build:
# context: .
# dockerfile: .devcontainer/Dockerfile
build:
context: .
dockerfile: .devcontainer/Dockerfile
args:
- PY_VER=${PY_VER:-3.8}
- DISTRO=${DISTRO:-buster}

volumes:
# Update this to wherever you want VS Code to mount the folder of your project
Expand All @@ -21,6 +23,8 @@ services:
# security_opt:
# - seccomp:unconfined

user: root

# Overrides default command so things don't shut down after the process ends.
command: /bin/sh -c "while sleep 1000; do :; done"

0 comments on commit 92f6d6e

Please sign in to comment.