feat: entrypoint
This commit is contained in:
+4
-1
@@ -15,9 +15,12 @@ COPY --from=builder /app/node_modules ./node_modules
|
|||||||
COPY --from=builder /app/.next ./.next
|
COPY --from=builder /app/.next ./.next
|
||||||
COPY --from=builder /app/public ./public
|
COPY --from=builder /app/public ./public
|
||||||
COPY --from=builder /app/prisma ./prisma
|
COPY --from=builder /app/prisma ./prisma
|
||||||
COPY --from=builder /app/next.config.ts ./next.config.ts
|
COPY --from=builder /app/next.config.js ./next.config.js
|
||||||
|
COPY entrypoint.sh /app/entrypoint.sh
|
||||||
|
RUN chmod +x /app/entrypoint.sh
|
||||||
RUN npm prune --omit=dev
|
RUN npm prune --omit=dev
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
CMD ["npm", "start", "--", "-p", "3000", "-H", "0.0.0.0"]
|
CMD ["npm", "start", "--", "-p", "3000", "-H", "0.0.0.0"]
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||||
CMD wget -q --spider http://localhost:3000/ || exit 1
|
CMD wget -q --spider http://localhost:3000/ || exit 1
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
NGINX_PROXY_NAME="${NGINX_PROXY_CONTAINER_NAME:-nginx-proxy}"
|
||||||
|
|
||||||
|
TARGET_DOMAIN=$(echo "$MINIO_PUBLIC_URL" | sed -E 's#^https?://##; s#/.*##; s#:.*##')
|
||||||
|
|
||||||
|
if [ -n "$TARGET_DOMAIN" ]; then
|
||||||
|
IP=$(getent hosts "$NGINX_PROXY_NAME" | awk '{ print $1 }' | head -n1)
|
||||||
|
|
||||||
|
if [ -n "$IP" ]; then
|
||||||
|
echo "$IP $TARGET_DOMAIN" >> /etc/hosts
|
||||||
|
echo "[entrypoint] resolved $NGINX_PROXY_NAME -> $IP for $TARGET_DOMAIN"
|
||||||
|
else
|
||||||
|
echo "[entrypoint] WARNING: could not resolve $NGINX_PROXY_NAME, using public DNS as fallback"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
Reference in New Issue
Block a user