Attempt at dynamic env vars, thanx TheBestMoshe
continuous-integration/drone/push Build is failing Details

b5b0eb5a97
This commit is contained in:
3wc 2022-01-05 11:24:41 +02:00
parent 5a9fed9318
commit e1eb849679
2 changed files with 9 additions and 5 deletions

View File

@ -8,10 +8,8 @@ RUN yarn install --frozen-lockfile
FROM node:14 as builder
WORKDIR /app
ARG BASE_URL
ENV BASE_URL $BASE_URL
ARG NEXT_PUBLIC_APP_URL
ENV NEXT_PUBLIC_APP_URL $NEXT_PUBLIC_APP_URL
ENV BASE_URL=APP_BASE_URL_VAR
ENV NEXT_PUBLIC_APP_URL=APP_NEXT_PUBLIC_APP_URL_VAR
COPY calendso .
@ -30,7 +28,7 @@ COPY --from=builder /app/next-i18next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/package.json ./package.json
COPY scripts scripts
COPY scripts scripts
EXPOSE 3000
CMD ["/app/scripts/start.sh"]

View File

@ -1,6 +1,12 @@
#!/bin/sh
set -x
# Set environment variables
echo BASE_URL $BASE_URL
echo NEXT_PUBLIC_APP_URL "$NEXT_PUBLIC_APP_URL"
find \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#APP_NEXT_PUBLIC_APP_URL_VAR#$NEXT_PUBLIC_APP_URL#g"
find \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#APP_BASE_URL_VAR#$BASE_URL#g"
/app/scripts/wait-for-it.sh ${DATABASE_HOST} -- echo "database is up"
npx prisma migrate deploy
yarn start