Added docker environment.
This commit is contained in:
25
docker/Dockerfile
Normal file
25
docker/Dockerfile
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
FROM rust:1.57 as builder
|
||||||
|
WORKDIR /usr/src/godaddy_ddns
|
||||||
|
COPY . .
|
||||||
|
RUN cargo install --path .
|
||||||
|
|
||||||
|
FROM debian:buster-slim
|
||||||
|
|
||||||
|
# Install dependencies.
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y ca-certificates libssl-dev cron && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Add application from builder container.
|
||||||
|
COPY --from=builder /usr/local/cargo/bin/godaddy_ddns /usr/local/bin/godaddy_ddns
|
||||||
|
|
||||||
|
# Add crontab
|
||||||
|
COPY --from=builder /usr/src/godaddy_ddns/docker/crontab /etc/cron.d/godaddy_ddns
|
||||||
|
RUN chmod 0644 /etc/cron.d/godaddy_ddns
|
||||||
|
RUN crontab /etc/cron.d/godaddy_ddns
|
||||||
|
|
||||||
|
# Add entrypoint
|
||||||
|
COPY --from=builder /usr/src/godaddy_ddns/docker/entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
CMD ["/entrypoint.sh"]
|
||||||
6
docker/crontab
Normal file
6
docker/crontab
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
SHELL=/bin/bash
|
||||||
|
BASH_ENV=/etc/profile
|
||||||
|
PATH="/usr/local/bin:/usr/bin:/bin"
|
||||||
|
|
||||||
|
@reboot godaddy_ddns > /proc/1/fd/1 2>/proc/1/fd/2
|
||||||
|
*/10 * * * * godaddy_ddns > /proc/1/fd/1 2>/proc/1/fd/2
|
||||||
6
docker/entrypoint.sh
Normal file
6
docker/entrypoint.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Export environment variables.
|
||||||
|
eval $(printenv | awk -F= '{print "export " "\""$1"\"""=""\""$2"\"" }' >> /etc/profile)
|
||||||
|
|
||||||
|
cron -f
|
||||||
Reference in New Issue
Block a user