-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_OrthancKube
63 lines (47 loc) · 2.01 KB
/
Dockerfile_OrthancKube
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Use Ubuntu as the base image
FROM ubuntu:jammy-20240125
# Metadata as key/value label
LABEL maintainer="iejohnson"
LABEL authors="iejohnson"
# Avoid user interaction with tzdata when installing
ARG DEBIAN_FRONTEND="noninteractive"
# Argument to determine the Orthanc instance type
ARG ORTHANC_INSTANCE="internal_pacs"
# Timezone can be overridden during build if needed
ARG TZ="America/Chicago"
ENV TZ=${TZ}
# Ensure UTF-8 locale
ENV LANG C.UTF-8
# Add non-root user and group
# Note: The -S option is for Alpine. Use `adduser` and `addgroup` without -S for Ubuntu.
# https://stackoverflow.com/questions/27701930/how-to-add-users-to-docker-container
RUN groupadd nonroot \
&& useradd -m -s /bin/bash -g nonroot nonroot
# Working directory for the application
WORKDIR /usr/src/app
# Copy files as root user
COPY example_tool/Orthanc/Linux /usr/src/app/Linux
COPY example_tool/Orthanc/example_internal_pacs_for_minikube.json.in /usr/src/app/example_internal_pacs_for_minikube.json.in
COPY example_tool/Orthanc/example_internal_pacs.lua /usr/src/app/example_internal_pacs.lua
COPY example_tool/Orthanc/run_${ORTHANC_INSTANCE}_for_minikube.sh /usr/src/app/run_orthanc.sh
# Make the script executable
RUN chmod +x /usr/src/app/run_orthanc.sh
# Change ownership of the app directory to the nonroot user
RUN chown -R nonroot:nonroot /usr/src/app
# Install dependencies and clean up in one layer to keep the image size down
# Combine installation commands and clean up to reduce layer size and simplify.
# Install dependencies, avoiding recommended and suggested packages, then clean up
RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \
tzdata \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Use the nonroot user
USER nonroot
# Arguments to customize ports; these can be overridden during build
ARG DCMPORT
ARG HTTPPORT
# Expose ports based on ARGs to make it flexible
EXPOSE $DCMPORT $HTTPPORT
# Command to run the application
CMD ["/usr/src/app/run_orthanc.sh"]