-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1183 from datajoint/docker-img-refactor
Refactor Docker image and package builds
- Loading branch information
Showing
19 changed files
with
217 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
ARG IMAGE=djbase | ||
ARG IMAGE=mambaorg/micromamba:1.5-bookworm-slim | ||
FROM ${IMAGE} | ||
|
||
ARG CONDA_BIN=micromamba | ||
ARG PY_VER=3.9 | ||
ARG DISTRO=debian | ||
FROM datajoint/${IMAGE}:py${PY_VER}-${DISTRO} | ||
COPY --chown=anaconda:anaconda ./setup.py ./datajoint.pub ./requirements.txt /main/ | ||
COPY --chown=anaconda:anaconda ./datajoint /main/datajoint | ||
ARG HOST_UID=1000 | ||
|
||
RUN ${CONDA_BIN} install --no-pin -qq -y -n base -c conda-forge \ | ||
python=${PY_VER} pip setuptools git graphviz pydot && \ | ||
${CONDA_BIN} clean -qq -afy | ||
ENV PATH="$PATH:/home/mambauser/.local/bin" | ||
|
||
COPY --chown=${HOST_UID:-1000}:mambauser ./pyproject.toml ./README.md ./LICENSE.txt /main/ | ||
COPY --chown=${HOST_UID:-1000}:mambauser ./datajoint /main/datajoint | ||
|
||
VOLUME /src | ||
WORKDIR /src | ||
USER root | ||
RUN \ | ||
pip install --no-cache-dir /main && \ | ||
chown -R ${HOST_UID:-1000}:mambauser /main && \ | ||
chown -R ${HOST_UID:-1000}:mambauser /src && \ | ||
${CONDA_BIN} run -n base pip install -q --no-cache-dir /main && \ | ||
rm -r /main/* | ||
USER ${MAMBA_USER} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# HOST_UID=$(id -u) PY_VER=3.11 DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py) docker compose --profile test up --build --exit-code-from djtest djtest | ||
services: | ||
db: | ||
image: datajoint/mysql:${MYSQL_VER:-8.0} | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=${DJ_PASS:-password} | ||
command: mysqld --default-authentication-plugin=mysql_native_password | ||
# ports: | ||
# - "3306:3306" | ||
# volumes: | ||
# - ./mysql/data:/var/lib/mysql | ||
healthcheck: | ||
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ] | ||
timeout: 30s | ||
retries: 5 | ||
interval: 15s | ||
minio: | ||
image: minio/minio:${MINIO_VER:-RELEASE.2022-08-11T04-37-28Z} | ||
environment: | ||
- MINIO_ACCESS_KEY=datajoint | ||
- MINIO_SECRET_KEY=datajoint | ||
# ports: | ||
# - "9000:9000" | ||
# volumes: | ||
# - ./minio/config:/root/.minio | ||
# - ./minio/data:/data | ||
command: server --address ":9000" /data | ||
healthcheck: | ||
test: | ||
- "CMD" | ||
- "curl" | ||
- "--fail" | ||
- "http://minio:9000/minio/health/live" | ||
timeout: 30s | ||
retries: 5 | ||
interval: 15s | ||
app: | ||
image: datajoint/datajoint:${DJ_VERSION:-latest} | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
PY_VER: ${PY_VER:-3.8} | ||
HOST_UID: ${HOST_UID:-1000} | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
minio: | ||
condition: service_healthy | ||
environment: | ||
- DJ_HOST=db | ||
- DJ_USER=root | ||
- DJ_PASS=password | ||
- DJ_TEST_HOST=db | ||
- DJ_TEST_USER=datajoint | ||
- DJ_TEST_PASSWORD=datajoint | ||
- S3_ENDPOINT=minio:9000 | ||
- S3_ACCESS_KEY=datajoint | ||
- S3_SECRET_KEY=datajoint | ||
- S3_BUCKET=datajoint.test | ||
- PYTHON_USER=dja | ||
- JUPYTER_PASSWORD=datajoint | ||
working_dir: /src | ||
user: ${HOST_UID:-1000}:mambauser | ||
volumes: | ||
- .:/src | ||
djtest: | ||
extends: | ||
service: app | ||
profiles: ["test"] | ||
command: | ||
- sh | ||
- -c | ||
- | | ||
set -e | ||
pip install -q -e ".[test]" | ||
pip freeze | grep datajoint | ||
pytest --cov-report term-missing --cov=datajoint tests | ||
Oops, something went wrong.