Skip to content

Commit

Permalink
Add Dockerfile to initial repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ronald-jaepel committed Feb 17, 2025
1 parent 2192bc3 commit 4ba5996
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions cadetrdm/docker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

from .containerAdapter import ContainerAdapter
from .dockerAdapter import DockerAdapter
from .dockerfile_template import dockerfile_template

8 changes: 5 additions & 3 deletions cadetrdm/docker/dockerAdapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import tempfile
from pathlib import Path

import docker
from docker.types import Mount
from docker.models.images import Image
try:
import docker
from docker.models.images import Image
except ImportError:
print("Warning: no python-docker-interface installation found.")

from cadetrdm.docker import ContainerAdapter

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dockerfile_template = """
# syntax=docker/dockerfile:1
# Comments are provided throughout this file to help you get started.
Expand Down Expand Up @@ -28,4 +29,5 @@
COPY environment.yml /tmp/environment.yml
RUN conda env update -n base --file /tmp/environment.yml
RUN conda env update -n base --file /tmp/environment.yml
"""
6 changes: 5 additions & 1 deletion cadetrdm/initialize_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import cadetrdm
from cadetrdm.repositories import ProjectRepo, OutputRepo
from cadetrdm.io_utils import write_lines_to_file, wait_for_user, init_lfs, test_for_lfs

from cadetrdm.docker import dockerfile_template

def initialize_repo(path_to_repo: str | Path, output_folder_name: (str | bool) = "output", gitignore: list = None,
gitattributes: list = None, output_repo_kwargs: dict = None):
Expand Down Expand Up @@ -61,6 +61,7 @@ def initialize_repo(path_to_repo: str | Path, output_folder_name: (str | bool) =

create_readme()
create_environment_yml()
create_dockerfile()

ProjectRepo._add_jupytext_file()

Expand Down Expand Up @@ -226,6 +227,9 @@ def create_output_readme():
write_lines_to_file("README.md", readme_lines, open_type="a")


def create_dockerfile():
write_lines_to_file("Dockerfile", dockerfile_template, open_type="w")

def clone(project_url, path_to_repo: str = None, multi_options: List[str] = None):
"""
Clone a remote repository
Expand Down

0 comments on commit 4ba5996

Please sign in to comment.