diff --git a/cmd/scraper/Dockerfile b/cmd/scraper/Dockerfile index f0a961f..0cb6b09 100644 --- a/cmd/scraper/Dockerfile +++ b/cmd/scraper/Dockerfile @@ -17,15 +17,9 @@ WORKDIR /app COPY --from=go-builder /app/scraper-build . -# Create entrypoint script -RUN echo '#!/bin/bash' > /app/entrypoint.sh && \ - echo 'set -e' >> /app/entrypoint.sh && \ - echo 'if [ "$SCRAPER_ONETIME" = "true" ] && [ -n "$FROM_DATE" ] && [ -n "$TO_DATE" ]; then' >> /app/entrypoint.sh && \ - echo ' exec /app/scraper-build -onetime -from "$FROM_DATE" -to "$TO_DATE"' >> /app/entrypoint.sh && \ - echo 'else' >> /app/entrypoint.sh && \ - echo ' exec /app/scraper-build' >> /app/entrypoint.sh && \ - echo 'fi' >> /app/entrypoint.sh && \ - chmod +x /app/entrypoint.sh +# Copy and set up entrypoint script +COPY cmd/scraper/entrypoint.sh /app/entrypoint.sh +RUN chmod +x /app/entrypoint.sh EXPOSE 80 diff --git a/cmd/scraper/entrypoint.sh b/cmd/scraper/entrypoint.sh new file mode 100644 index 0000000..5cd4f49 --- /dev/null +++ b/cmd/scraper/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +if [ "$SCRAPER_ONETIME" = "true" ] && [ -n "$FROM_DATE" ] && [ -n "$TO_DATE" ]; then + exec /app/scraper-build -onetime -from "$FROM_DATE" -to "$TO_DATE" +else + exec /app/scraper-build +fi +