2021-12-26 09:07:22 -08:00
|
|
|
########################################################################################################################
|
|
|
|
## Builder
|
|
|
|
########################################################################################################################
|
2021-12-26 03:15:35 -08:00
|
|
|
FROM rust:1.57 as builder
|
2021-12-26 09:07:22 -08:00
|
|
|
|
|
|
|
RUN update-ca-certificates
|
|
|
|
|
|
|
|
WORKDIR /usr/src
|
|
|
|
|
2021-12-26 03:15:35 -08:00
|
|
|
COPY . .
|
|
|
|
|
2021-12-26 09:07:22 -08:00
|
|
|
RUN cargo build --release
|
|
|
|
RUN strip -s /usr/src/target/release/godaddy_ddns
|
|
|
|
|
|
|
|
########################################################################################################################
|
|
|
|
## Final image
|
|
|
|
########################################################################################################################
|
|
|
|
FROM debian:bullseye-slim
|
2021-12-26 03:15:35 -08:00
|
|
|
|
|
|
|
# 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.
|
2021-12-26 09:07:22 -08:00
|
|
|
COPY --from=builder /usr/src/target/release/godaddy_ddns /usr/local/bin/godaddy_ddns
|
2021-12-26 03:15:35 -08:00
|
|
|
|
|
|
|
# Add crontab
|
2021-12-26 09:07:22 -08:00
|
|
|
COPY --from=builder /usr/src/docker/crontab /etc/cron.d/godaddy_ddns
|
2021-12-26 03:15:35 -08:00
|
|
|
RUN chmod 0644 /etc/cron.d/godaddy_ddns
|
|
|
|
RUN crontab /etc/cron.d/godaddy_ddns
|
|
|
|
|
|
|
|
# Add entrypoint
|
2021-12-26 09:07:22 -08:00
|
|
|
COPY --from=builder /usr/src/docker/entrypoint.sh /entrypoint.sh
|
2021-12-26 03:15:35 -08:00
|
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
|
|
|
|
CMD ["/entrypoint.sh"]
|