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