|
1 |
| - |
2 |
| -# Create a build argument |
3 |
| -ARG BUILD_STAGE |
4 |
| -ARG BUILD_STAGE=${BUILD_STAGE:-prod} |
5 |
| - |
6 |
| -############# Build Stage: Dependencies ################## |
7 |
| - |
8 |
| -# Start from a base image |
9 |
| -FROM --platform=linux/amd64 ubuntu:focal as base |
10 |
| - |
11 |
| -# Define a system argument |
12 |
| -ARG DEBIAN_FRONTEND=noninteractive |
13 |
| - |
14 |
| -# Install system libraries of general use |
15 |
| -RUN apt-get update --allow-releaseinfo-change && apt-get install --no-install-recommends -y \ |
16 |
| - build-essential \ |
17 |
| - iptables \ |
18 |
| - libdevmapper1.02.1 \ |
19 |
| - python3.7\ |
20 |
| - python3-pip \ |
21 |
| - python3-setuptools \ |
22 |
| - python3-dev \ |
23 |
| - dpkg \ |
24 |
| - sudo \ |
25 |
| - wget \ |
26 |
| - curl \ |
27 |
| - dos2unix |
28 |
| - |
29 |
| -############# Build Stage: Development ################## |
30 |
| - |
31 |
| -# Build from the base image for dev |
32 |
| -FROM base as dev |
33 |
| - |
34 |
| -# Create working directory variable |
35 |
| -ENV WORKDIR=/data |
36 |
| - |
37 |
| -# Create a stage enviroment |
38 |
| -ENV STAGE=dev |
39 |
| - |
40 |
| -############# Build Stage: Production ################## |
41 |
| - |
42 |
| -# Build from the base image for prod |
43 |
| -FROM base as prod |
44 |
| - |
45 |
| -# Create working directory variable |
46 |
| -ENV WORKDIR=/data |
47 |
| - |
48 |
| -# Create a stage enviroment |
49 |
| -ENV STAGE=prod |
50 |
| - |
51 |
| -# Copy all scripts to docker images |
52 |
| -COPY . /MIRA |
53 |
| - |
54 |
| -############# Build Stage: Final ################## |
55 |
| - |
56 |
| -# Build the final image |
57 |
| -FROM ${BUILD_STAGE} as final |
58 |
| - |
59 |
| -# Set up volume directory in docker |
60 |
| -VOLUME ${WORKDIR} |
61 |
| - |
62 |
| -# Set up working directory in docker |
63 |
| -WORKDIR ${WORKDIR} |
64 |
| - |
65 |
| -# Allow permission to read and write files to current working directory |
66 |
| -RUN chmod -R a+rwx ${WORKDIR} |
67 |
| - |
68 |
| -############# Install Docker ################## |
69 |
| - |
70 |
| -# Copy all files to docker images |
71 |
| -COPY docker /MIRA/docker |
72 |
| - |
73 |
| -# Copy all files to docker images |
74 |
| -COPY install_docker.sh /MIRA/install_docker.sh |
75 |
| - |
76 |
| -# Convert bash script from Windows style line endings to Unix-like control characters |
77 |
| -RUN dos2unix /MIRA/install_docker.sh |
78 |
| - |
79 |
| -# Allow permission to excute the bash script |
80 |
| -RUN chmod a+x /MIRA/install_docker.sh |
81 |
| - |
82 |
| -# Execute bash script to install the package |
83 |
| -RUN bash /MIRA/install_docker.sh |
84 |
| - |
85 |
| -############# Install python packages ################## |
86 |
| - |
87 |
| -# Copy python requirements file to docker images |
88 |
| -COPY requirements.txt /MIRA/requirements.txt |
89 |
| - |
90 |
| -# Install python requirements |
91 |
| -RUN pip3 install --no-cache-dir -r /MIRA/requirements.txt |
92 |
| - |
93 |
| -############# Launch MIRA dashboard ################## |
94 |
| - |
95 |
| -# Copy all files to docker images |
96 |
| -COPY dashboard-kickoff /MIRA/dashboard-kickoff |
97 |
| - |
98 |
| -# Convert bash script from Windows style line endings to Unix-like control characters |
99 |
| -RUN dos2unix /MIRA/dashboard-kickoff |
100 |
| - |
101 |
| -# Allow permission to excute the bash scripts |
102 |
| -RUN chmod a+x /MIRA/dashboard-kickoff |
103 |
| - |
104 |
| -# Allow permission to read and write files to MIRA directory |
105 |
| -RUN chmod -R a+rwx /MIRA |
106 |
| - |
107 |
| -# Make the app available at port 8050 |
108 |
| -EXPOSE 8050 |
109 |
| - |
110 |
| -# Clean up |
111 |
| -RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* |
112 |
| - |
113 |
| -# Export bash script to path |
114 |
| -ENV PATH "$PATH:/MIRA" |
115 |
| - |
116 |
| -# Execute the pipeline |
117 |
| -ENTRYPOINT ["bash", "dashboard-kickoff"] |
| 1 | +# Create an argument to pull a particular version of dias image |
| 2 | +ARG spyne_image |
| 3 | +ARG spyne_image=${spyne_image:-cdcgov/spyne:latest} |
| 4 | + |
| 5 | +############# spyne image as base ################## |
| 6 | +FROM ${spyne_image} as spyne |
| 7 | +RUN echo "Getting spyne image" |
| 8 | + |
| 9 | +# local apt mirror support |
| 10 | +# start every stage with updated apt sources |
| 11 | +ARG APT_MIRROR_NAME= |
| 12 | +RUN if [ -n "$APT_MIRROR_NAME" ]; then sed -i.bak -E '/security/! s^https?://.+?/(debian|ubuntu)^http://'"$APT_MIRROR_NAME"'/\1^' /etc/apt/sources.list && grep '^deb' /etc/apt/sources.list; fi |
| 13 | + |
| 14 | +# Install and update system libraries of general use |
| 15 | +RUN apt-get update --allow-releaseinfo-change --fix-missing \ |
| 16 | + && apt-get install --no-install-recommends -y \ |
| 17 | + build-essential \ |
| 18 | + iptables \ |
| 19 | + python3.7 \ |
| 20 | + python3-pip \ |
| 21 | + python3-setuptools \ |
| 22 | + dos2unix |
| 23 | + |
| 24 | +# Create a working directory variable |
| 25 | +ENV WORKDIR=/data |
| 26 | + |
| 27 | +# Set up volume directory |
| 28 | +VOLUME ${WORKDIR} |
| 29 | + |
| 30 | +# Set up working directory |
| 31 | +WORKDIR ${WORKDIR} |
| 32 | + |
| 33 | +# Create a program variable |
| 34 | +ENV MIRA_PROGRAM_DIR=/MIRA |
| 35 | + |
| 36 | +# Set up volume directory |
| 37 | +VOLUME ${MIRA_PROGRAM_DIR} |
| 38 | + |
| 39 | +# Copy all scripts to docker images |
| 40 | +COPY . ${MIRA_PROGRAM_DIR} |
| 41 | + |
| 42 | +############# Install python packages ################## |
| 43 | + |
| 44 | +# Copy python requirements file to docker images |
| 45 | +COPY requirements.txt ${MIRA_PROGRAM_DIR}/requirements.txt |
| 46 | + |
| 47 | +# Install python requirements |
| 48 | +RUN pip3 install --no-cache-dir -r ${MIRA_PROGRAM_DIR}/requirements.txt |
| 49 | + |
| 50 | +############# Launch MIRA dashboard ################## |
| 51 | + |
| 52 | +# Copy all files to docker images |
| 53 | +COPY dashboard-kickoff ${MIRA_PROGRAM_DIR}/dashboard-kickoff |
| 54 | + |
| 55 | +# Convert bash script from Windows style line endings to Unix-like control characters |
| 56 | +RUN dos2unix ${MIRA_PROGRAM_DIR}/dashboard-kickoff |
| 57 | + |
| 58 | +# Allow permission to excute the bash scripts |
| 59 | +RUN chmod a+x ${MIRA_PROGRAM_DIR}/dashboard-kickoff |
| 60 | + |
| 61 | +# Allow permission to read and write files to MIRA directory |
| 62 | +RUN chmod -R a+rwx ${MIRA_PROGRAM_DIR} |
| 63 | + |
| 64 | +# Make the app available at port 8050 |
| 65 | +EXPOSE 8050 |
| 66 | + |
| 67 | +# Clean up and remove unwanted files |
| 68 | +RUN apt-get autoremove -y \ |
| 69 | + && apt-get clean -y \ |
| 70 | + && rm -rf /var/lib/{apt,dpkg,cache,log}/ |
| 71 | + |
| 72 | +# Export dais-ribosome script to path |
| 73 | +ENV PATH "$PATH:/dais-ribosome" |
| 74 | + |
| 75 | +# Export irma script to path |
| 76 | +ENV PATH "$PATH:/flu-amd" |
| 77 | + |
| 78 | +# Export spyne script to path |
| 79 | +ENV PATH "$PATH:/spyne" |
| 80 | + |
| 81 | +# Execute the pipeline |
| 82 | +ENTRYPOINT ["/bin/bash", "-c", "/MIRA/dashboard-kickoff"] |
0 commit comments