Added cronjob container (closes #29)
parent
e62cd0bb93
commit
fee37420cd
|
@ -16,3 +16,5 @@
|
|||
|
||||
# Database migrations
|
||||
!migrations/
|
||||
|
||||
!docker/crontab
|
||||
|
|
|
@ -20,9 +20,11 @@ RUN cargo install \
|
|||
|
||||
# Now, we create the actual image
|
||||
FROM alpine:latest
|
||||
COPY ./docker/crontab /var/spool/cron/crontabs/fej
|
||||
|
||||
# Install some dynamic libraries needed for everything to work
|
||||
# Create -non-root user
|
||||
# Change permissions for crontab file
|
||||
RUN apk update && \
|
||||
apk add --no-cache \
|
||||
curl \
|
||||
|
@ -42,7 +44,6 @@ COPY --from=builder --chown=fej:fej /app/output/bin /app/bin
|
|||
# The workdir is changed so that the config file is read properly
|
||||
WORKDIR /app
|
||||
COPY --chown=fej:fej Rocket.toml /app/Rocket.toml
|
||||
COPY ./docker/entrypoint.sh /entrypoint.sh
|
||||
|
||||
HEALTHCHECK \
|
||||
--interval=10s \
|
||||
|
@ -51,4 +52,4 @@ HEALTHCHECK \
|
|||
--retries=3 \
|
||||
CMD curl -q localhost:8000
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
ENTRYPOINT ["/app/bin/server"]
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# This'll be filled up later
|
|
@ -12,6 +12,16 @@ services:
|
|||
environment:
|
||||
- 'DATABASE_URL=postgres://fej:fej@db:5432/fej'
|
||||
|
||||
cron:
|
||||
image: 'chewingbever/fej:latest'
|
||||
restart: 'always'
|
||||
|
||||
environment:
|
||||
- 'DATABASE_URL=postgres://fej:fej@db:5432/fej'
|
||||
|
||||
entrypoint: 'crond -f'
|
||||
user: 'root'
|
||||
|
||||
db:
|
||||
image: 'postgres:13-alpine'
|
||||
restart: 'always'
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
crond -b
|
||||
|
||||
exec "/app/bin/server"
|
Loading…
Reference in New Issue