1
0

Dockerfile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. FROM python:3.9-alpine
  2. ARG USER_ID=1000
  3. ARG GROUP_ID=1000
  4. ENV \
  5. USER_ID=$USER_ID \
  6. GROUP_ID=$GROUP_ID \
  7. SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.12/supercronic-linux-amd64 \
  8. SUPERCRONIC=supercronic-linux-amd64 \
  9. SUPERCRONIC_SHA1SUM=048b95b48b708983effb2e5c935a1ef8483d9e3e
  10. WORKDIR /usr/src/app
  11. COPY . .
  12. RUN \
  13. apk --no-cache add \
  14. build-base \
  15. curl \
  16. postgresql-dev && \
  17. curl -fsSLO "$SUPERCRONIC_URL" && \
  18. echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - && \
  19. chmod +x "$SUPERCRONIC" && \
  20. mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" && \
  21. ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic && \
  22. pip install \
  23. loguru~=0.5.3 \
  24. postgres~=3.0.0 \
  25. requests~=2.25.1 && \
  26. rm -r ~/.cache && \
  27. apk del build-base && \
  28. chown -R ${USER_ID}:${GROUP_ID} /usr/src/app && \
  29. mkdir /data && chown -R ${USER_ID}:${GROUP_ID} /data
  30. COPY docker-cmd-run.sh /usr/local/bin/run
  31. COPY docker-cmd-cron.sh /usr/local/bin/cron
  32. RUN \
  33. chmod +x /usr/local/bin/run && \
  34. chmod +x /usr/local/bin/cron
  35. USER ${USER_ID}:${GROUP_ID}
  36. CMD ["run"]