Skip to content

Commit

Permalink
chore: rename environment variable for PKCS trust store password
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Mar 1, 2024
1 parent 350ea16 commit 0938843
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ RUN apk add --no-cache --update npm nodejs curl git tini python3 make cmake g++
##
FROM alpine:3.19 AS runner

ARG PKCS_PASSWORD=changeme
ARG PKCS12_PASSWORD=changeme
ARG POSTGRES_USER=postgres
ARG POSTGRES_PASSWORD=postgres
ARG CA_CERT_SUBJECT="/CN=Self Signed CA"
ARG SERVER_CERT_SUBJECT="/CN=localhost"
ENV PKCS_PASSWORD=$PKCS_PASSWORD \

ENV PKCS12_PASSWORD=$PKCS12_PASSWORD \
PATH_TO_CERTS=/etc/routr/certs \
USER=fonoster \
GID=5000 \
Expand Down Expand Up @@ -71,15 +72,16 @@ RUN apk add --no-cache nodejs npm tini openssl postgresql postgresql-client su-e
&& chmod 2777 /run/postgresql \
&& export DATABASE_URL=${DATABASE_URL} && su -m postgres -c "/service/init-postgres.sh" \
&& rm -rf /var/cache/apk/* /tmp/* /services/migrations /services/schema.prisma /services/init-postgres.sh \
&& rm -rf /root/.npm /root/.config /root/.cache /root/.local \
&& /root/.npm /root/.config /root/.cache /root/.local \
&& apk del npm postgresql-client

ENTRYPOINT ["tini", "-v", "-e", "143", "--"]

CMD sh -c "su-exec postgres pg_ctl start -D /var/lib/postgresql/data --options='-h 0.0.0.0' && \
su-exec $USER ./convert-to-p12.sh $PATH_TO_CERTS $PKCS_PASSWORD && \
su-exec $USER ./convert-to-p12.sh $PATH_TO_CERTS $PKCS12_PASSWORD && \
if [ -n \"$HEPLIFY_OPTIONS\" ]; then \
heplify $HEPLIFY_OPTIONS & \
fi && \
sed -i 's|keyStorePassword: .*|keyStorePassword: ${PKCS_PASSWORD}|g' config/edgeport.yaml && \
sed -i 's|trustStorePassword: .*|trustStorePassword: ${PKCS_PASSWORD}|g' config/edgeport.yaml && \
sed -i 's|keyStorePassword: .*|keyStorePassword: ${PKCS12_PASSWORD}|g' config/edgeport.yaml && \
sed -i 's|trustStorePassword: .*|trustStorePassword: ${PKCS12_PASSWORD}|g' config/edgeport.yaml && \
DATABASE_URL=$DATABASE_URL su-exec $USER node ./dist/runner"
5 changes: 3 additions & 2 deletions mods/edgeport/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ USER 1000:3000

# Re-mapping the signal from 143 to 0
ENTRYPOINT ["tini", "-v", "-e", "143", "--"]

CMD ["sh", "-c", "set -e && \
./convert-to-p12.sh $PATH_TO_CERTS $PKCS12_PASSWORD && \
sed -i 's|keyStorePassword: .*|keyStorePassword: ${PKCS_PASSWORD}|g' config/edgeport.yaml && \
sed -i 's|trustStorePassword: .*|trustStorePassword: ${PKCS_PASSWORD}|g' config/edgeport.yaml && \
sed -i 's|keyStorePassword: .*|keyStorePassword: ${PKCS12_PASSWORD}|g' config/edgeport.yaml && \
sed -i 's|trustStorePassword: .*|trustStorePassword: ${PKCS12_PASSWORD}|g' config/edgeport.yaml && \
if [ -n \"$HEPLIFY_OPTIONS\" ]; then \
./heplify $HEPLIFY_OPTIONS & \
fi && \
Expand Down

0 comments on commit 0938843

Please sign in to comment.