Skip to content

Commit 4ed4d20

Browse files
committed
Fix directory permissions
Signed-off-by: Kaur Palang <[email protected]>
1 parent da28677 commit 4ed4d20

File tree

3 files changed

+76
-10
lines changed

3 files changed

+76
-10
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: build-images.yaml
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
validate-yaml:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
12+
- name: Check for duplicate slugs
13+
working-directory: deploy
14+
run: yq '.versions | map(.slug) | group_by(.) | map(select(length > 1) | .[0])' releases.yaml
15+
16+
get-gomplate:
17+
runs-on: ubuntu-latest
18+
env:
19+
GOMPLATE_VERSION: 4.3.2
20+
GOMPLATE_SHA512: ed77ea781cc2b63fbb325dbb29bbe3041f5158ccaec555fdc79b6ecca1b4c48fb6be2fee6612469c715b77fb9179be6e263ee1d58773232dfc346249afe660ab
21+
GOMPLATE_DIR: ${{ github.workspace }}/.cache/gomplate
22+
GOMPLATE_BIN: ${{ github.workspace }}/.cache/gomplate/gomplate
23+
steps:
24+
- name: Cache gomplate binary
25+
id: cache
26+
uses: actions/cache@v4
27+
with:
28+
path: ${{ env.GOMPLATE_DIR }}
29+
key: |
30+
gomplate-${{ env.GOMPLATE_VERSION }}-${{ env.GOMPLATE_SHA512 }}
31+
restore-keys: |
32+
gomplate-${{ env.GOMPLATE_VERSION }}-
33+
34+
- name: Download gomplate
35+
if: steps.cache.outputs.cache-hit != 'true'
36+
shell: bash
37+
run: |
38+
mkdir -p "${GOMPLATE_DIR}"
39+
curl -fsSL --output "${GOMPLATE_BIN}" "https://github.com/hairyhenderson/gomplate/releases/download/v$GOMPLATE_VERSION/gomplate_linux-amd64"
40+
echo "${{ env.GOMPLATE_SHA512 }} ${GOMPLATE_BIN}" | sha512sum --check --status
41+
chmod +x "${GOMPLATE_BIN}"
42+
43+
# 4. Put gomplate on PATH for the rest of the job.
44+
- name: Add gomplate to PATH
45+
shell: bash
46+
run: echo "${GOMPLATE_DIR}" >> "${GITHUB_PATH}"
47+
48+
# Example: prove it works
49+
- name: Show gomplate version
50+
run: gomplate --version
51+
52+
render-dockerfiles:
53+
runs-on: ubuntu-latest
54+
needs:
55+
- validate-yaml
56+
- get-gomplate
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v4
60+
61+
- name: Render Dockerfiles
62+
working-directory: templating
63+
run: |
64+
./gomplate

dockerfiles/4.5.2-tp.1/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ COPY --chmod=755 entrypoint.sh /opt/engine/entrypoint.sh
2828

2929
RUN rm -rf cli-lib manager-lib \
3030
&& rm mirth-cli-launcher.jar oiecommand
31-
32-
RUN chown -R 1000:1000 /opt/engine
3331
FROM eclipse-temurin:17.0.15_6-jre-noble AS ubuntu-jre
3432

3533
ARG CREATED_AT
@@ -52,7 +50,8 @@ RUN apt-get update \
5250
&& rm -rf /var/lib/apt/lists/* \
5351
&& groupmod --new-name engine ubuntu \
5452
&& usermod -l engine ubuntu \
55-
&& usermod -aG engine engine
53+
&& usermod -aG engine engine \
54+
&& chown -R 1000:1000 /opt/engine
5655

5756
VOLUME /opt/engine/appdata
5857
VOLUME /opt/engine/custom-extensions
@@ -86,7 +85,8 @@ RUN apt-get update \
8685
&& rm -rf /var/lib/apt/lists/* \
8786
&& groupmod --new-name engine ubuntu \
8887
&& usermod -l engine ubuntu \
89-
&& usermod -aG engine engine
88+
&& usermod -aG engine engine \
89+
&& chown -R 1000:1000 /opt/engine
9090

9191
VOLUME /opt/engine/appdata
9292
VOLUME /opt/engine/custom-extensions
@@ -116,7 +116,8 @@ LABEL \
116116
COPY --from=downloader /opt/engine /opt/engine
117117

118118
RUN apk add --no-cache bash unzip \
119-
&& adduser -D -H -u 1000 engine engine
119+
&& adduser -D -H -u 1000 engine engine \
120+
&& chown -R 1000:1000 /opt/engine
120121

121122
VOLUME /opt/engine/appdata
122123
VOLUME /opt/engine/custom-extensions
@@ -146,7 +147,8 @@ LABEL \
146147
COPY --from=downloader /opt/engine /opt/engine
147148

148149
RUN apk add --no-cache bash unzip \
149-
&& adduser -D -H -u 1000 engine engine
150+
&& adduser -D -H -u 1000 engine engine \
151+
&& chown -R 1000:1000 /opt/engine
150152

151153
VOLUME /opt/engine/appdata
152154
VOLUME /opt/engine/custom-extensions

templates/Dockerfile.tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ COPY --chmod=755 entrypoint.sh /opt/engine/entrypoint.sh
4444
RUN rm -rf cli-lib manager-lib \
4545
&& rm mirth-cli-launcher.jar oiecommand
4646

47-
RUN chown -R {{ $.config.uid }}:{{ $.config.gid }} /opt/engine
48-
4947
{{- /* Assign current version slug into a variable to carry it into the tags iteration */}}
5048
{{- $slug := dict "slug" .version.slug -}}
5149
{{/* Iterate version tags to generate the final stages */}}
@@ -65,10 +63,12 @@ RUN apt-get update \
6563
&& rm -rf /var/lib/apt/lists/* \
6664
&& groupmod --new-name engine ubuntu \
6765
&& usermod -l engine ubuntu \
68-
&& usermod -aG engine engine
66+
&& usermod -aG engine engine \
67+
&& chown -R {{ $.config.uid }}:{{ $.config.gid }} /opt/engine
6968
{{- else if eq .distro "alpine" }}
7069
RUN apk add --no-cache bash unzip \
71-
&& adduser -D -H -u {{ $.config.uid }} engine engine
70+
&& adduser -D -H -u {{ $.config.uid }} engine engine \
71+
&& chown -R {{ $.config.uid }}:{{ $.config.gid }} /opt/engine
7272
{{- end }}
7373

7474
VOLUME /opt/engine/appdata

0 commit comments

Comments
 (0)