|
| 1 | +{{/* Collect all root elements except "versions" into a variable */}} |
| 2 | +{{- $config := coll.Omit "versions" . -}} |
| 3 | + |
| 4 | +{{/* Create gomplate specific iteration over versions array */}} |
| 5 | +{{- range $version := .versions -}} |
| 6 | + {{- $ctx := dict "config" $config "version" $version }} |
| 7 | + |
| 8 | + {{/* Define paths to render the Dockerfiles to */}} |
| 9 | + {{- $outPath := printf "dockerfiles/%s/Dockerfile" $version.slug }} |
| 10 | + |
| 11 | + {{/* Render the inline template defined below */}} |
| 12 | + {{- tmpl.Exec "dockerfile" $ctx | file.Write $outPath }} |
| 13 | +{{- end -}} |
| 14 | + |
| 15 | +{{- define "dockerfile" -}} |
| 16 | +# syntax=docker/dockerfile:1 |
| 17 | + |
| 18 | +################################################################ |
| 19 | +# # |
| 20 | +# WARNING: THIS FILE IS AUTO-GENERATED. DO NOT EDIT MANUALLY # |
| 21 | +# # |
| 22 | +################################################################ |
| 23 | + |
| 24 | +ARG CREATED_AT |
| 25 | + |
| 26 | +FROM alpine:{{ .config.downloaderTag }} AS downloader |
| 27 | + |
| 28 | +WORKDIR /opt |
| 29 | + |
| 30 | +# Download Open Integration Engine release |
| 31 | +RUN apk add --no-cache curl \ |
| 32 | + && curl -L \ |
| 33 | + -o /opt/engine.tar.gz \ |
| 34 | + -H "Accept: application/vnd.github+json" \ |
| 35 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 36 | + {{ .version.releaseUrl }} \ |
| 37 | + && tar xzf engine.tar.gz \ |
| 38 | + && mv /opt/oie /opt/engine \ |
| 39 | + && mkdir -p /opt/engine/appdata |
| 40 | + |
| 41 | +WORKDIR /opt/engine |
| 42 | +COPY --chmod=755 entrypoint.sh /opt/engine/entrypoint.sh |
| 43 | + |
| 44 | +RUN rm -rf cli-lib manager-lib \ |
| 45 | + && rm mirth-cli-launcher.jar oiecommand |
| 46 | + |
| 47 | +RUN chown -R {{ $.config.uid }}:{{ $.config.gid }} /opt/engine |
| 48 | + |
| 49 | +{{- /* Assign current version slug into a variable to carry it into the tags iteration */}} |
| 50 | +{{- $slug := dict "slug" .version.slug -}} |
| 51 | +{{/* Iterate version tags to generate the final stages */}} |
| 52 | +{{- range .version.tags }} |
| 53 | +FROM eclipse-temurin:{{ .tag }} AS {{ print .distro "-" .type }} |
| 54 | + |
| 55 | +ARG CREATED_AT |
| 56 | + |
| 57 | +LABEL \ |
| 58 | +{{/* Render the Labels section to include the slug */}} |
| 59 | +{{- tpl $.config.labels $slug | strings.Indent 2 }} |
| 60 | + |
| 61 | +COPY --from=downloader /opt/engine /opt/engine |
| 62 | +{{ if eq .distro "ubuntu" }} |
| 63 | +RUN apt-get update \ |
| 64 | + && apt-get install -y unzip \ |
| 65 | + && rm -rf /var/lib/apt/lists/* \ |
| 66 | + && groupmod --new-name engine ubuntu \ |
| 67 | + && usermod -l engine ubuntu \ |
| 68 | + && usermod -aG engine engine |
| 69 | +{{- else if eq .distro "alpine" }} |
| 70 | +RUN apk add --no-cache bash unzip \ |
| 71 | + && adduser -D -H -u {{ $.config.uid }} engine engine |
| 72 | +{{- end }} |
| 73 | +
|
| 74 | +VOLUME /opt/engine/appdata |
| 75 | +VOLUME /opt/engine/custom-extensions |
| 76 | +
|
| 77 | +WORKDIR /opt/engine |
| 78 | +EXPOSE 8443 |
| 79 | +USER engine |
| 80 | +
|
| 81 | +ENTRYPOINT ["./entrypoint.sh"] |
| 82 | +CMD ["./oieserver"] |
| 83 | +{{ end -}} |
| 84 | +
|
| 85 | +{{ end }} |
0 commit comments