update init procedure

This commit is contained in:
red 2025-04-09 11:42:12 -04:00
parent 2bed1a8222
commit 57c5a7db61
3 changed files with 7 additions and 15 deletions

View file

@ -17,22 +17,9 @@ spec:
imagePullSecrets:
- name: registry-credentials
initContainers:
- name: pleroma-static-files
- name: pleroma-init
image: cr.forge.lan/darkdork-dev/pleroma:${CI_COMMIT_SHA}
command: [ "sh", "-c", "mkdir -p ${DATA}/uploads && mkdir -p ${DATA}/static && cp -rf /static-files/* ${DATA}/static && chown -R 1000:1000 /var/lib/pleroma" ]
- name: pleroma-database-wait
image: cr.forge.lan/darkdork-dev/pleroma:${CI_COMMIT_SHA}
command: [ "sh", "-c", "while ! pg_isready -U ${DB_USER} -d postgres://${DB_HOST}:${DB_PORT}/${DB_NAME} -t 1; do sleep 1s; done;" ]
env:
- name: DB_HOST
value: postgres
- name: DB_NAME
value: pleroma
- name: DB_USER
value: pleroma
- name: pleroma-migrate
image: cr.forge.lan/darkdork-dev/pleroma:${CI_COMMIT_SHA}
command: [ "sh", "-c", "exec", "${HOME}/bin/pleroma_ctl migrate" ]
command: [ "/init-pleroma.sh" ]
containers:
- name: pleroma
image: cr.forge.lan/darkdork-dev/pleroma:${CI_COMMIT_SHA}

View file

@ -25,6 +25,7 @@ RUN rm -r /tmp/release
RUN rm /tmp/pleroma.zip
COPY --chmod=0764 --chown=pleroma:pleroma ./static-files/ /static-files/
COPY --chmod=0755 --chown=pleroma:pleroma ./init-pleroma.sh /
COPY --chmod=0755 --chown=pleroma:pleroma ./docker-entrypoint.sh ${HOME}
EXPOSE 4000

4
pleroma/init-pleroma.sh Normal file
View file

@ -0,0 +1,4 @@
#!/bin/sh
while ! pg_isready -U ${DB_USER} -d postgres://${DB_HOST}:${DB_PORT}/${DB_NAME} -t 1; do sleep 1s; done;
mkdir -p ${DATA}/uploads && mkdir -p ${DATA}/static && cp -rf /static-files/* ${DATA}/static && chown -R 1000:1000 ${DATA}
exec "${HOME}/bin/pleroma_ctl migrate"