Skip to content

Commit 4b13888

Browse files
committed
Add example of creating a new module (filter.py) with in a custom derived Docker
1 parent 62a102c commit 4b13888

4 files changed

Lines changed: 525 additions & 0 deletions

File tree

custom/custom.dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ----- 1. First stage to create a devcontainer -----
2+
# Start from standard python-ismrmrd-server devcontainer
3+
FROM kspacekelvin/fire-python-devcon AS fire-python-custom-devcon
4+
5+
# Clone the latest version of python-ismrmrd-server
6+
RUN cd /opt/code && \
7+
git clone https://github.com/kspaceKelvin/python-ismrmrd-server.git
8+
9+
# Install any additional package dependencies here
10+
RUN pip install scipy
11+
12+
# ----- 2. Second stage to create a runtime container for deployment -----
13+
FROM fire-python-custom-devcon AS fire-python-custom-runtime
14+
15+
# Copy in modules and other files as needed
16+
COPY filter.py /opt/code/python-ismrmrd-server
17+
COPY filter.json /opt/code/python-ismrmrd-server
18+
19+
# Set the starting directory so that code can use relative paths
20+
WORKDIR /opt/code/python-ismrmrd-server
21+
22+
# Use the -d argument at the end to indicate the default (intended) module to be run by this Docker image
23+
CMD [ "python3", "/opt/code/python-ismrmrd-server/main.py", "-v", "-H=0.0.0.0", "-p=9002", "-l=/tmp/python-ismrmrd-server.log", "-d=filter"]
24+
25+
# Replace the above CMD with this ENTRYPOINT to allow allow "docker stop"
26+
# commands to be passed to the server. This is useful for deployments, but
27+
# more annoying for development
28+
# ENTRYPOINT [ "python3", "/opt/code/python-ismrmrd-server/main.py", "-v", "-H=0.0.0.0", "-p=9002", "-l=/tmp/python-ismrmrd-server.log", "-d=filter"]

custom/filter.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"version": "1.1.0",
3+
"parameters": {
4+
"options": "",
5+
"filterSize": "3",
6+
"sendOriginal": "True"
7+
}
8+
}

0 commit comments

Comments
 (0)