Updated Dockerfile.

This commit is contained in:
shad0wflame 2021-12-26 18:07:22 +01:00
parent 355fd256c9
commit a61d3cd57b
1 changed files with 19 additions and 7 deletions

View File

@ -1,9 +1,21 @@
########################################################################################################################
## Builder
########################################################################################################################
FROM rust:1.57 as builder FROM rust:1.57 as builder
WORKDIR /usr/src/godaddy_ddns
COPY . .
RUN cargo install --path .
FROM debian:buster-slim RUN update-ca-certificates
WORKDIR /usr/src
COPY . .
RUN cargo build --release
RUN strip -s /usr/src/target/release/godaddy_ddns
########################################################################################################################
## Final image
########################################################################################################################
FROM debian:bullseye-slim
# Install dependencies. # Install dependencies.
RUN apt-get update && \ RUN apt-get update && \
@ -11,15 +23,15 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Add application from builder container. # Add application from builder container.
COPY --from=builder /usr/local/cargo/bin/godaddy_ddns /usr/local/bin/godaddy_ddns COPY --from=builder /usr/src/target/release/godaddy_ddns /usr/local/bin/godaddy_ddns
# Add crontab # Add crontab
COPY --from=builder /usr/src/godaddy_ddns/docker/crontab /etc/cron.d/godaddy_ddns COPY --from=builder /usr/src/docker/crontab /etc/cron.d/godaddy_ddns
RUN chmod 0644 /etc/cron.d/godaddy_ddns RUN chmod 0644 /etc/cron.d/godaddy_ddns
RUN crontab /etc/cron.d/godaddy_ddns RUN crontab /etc/cron.d/godaddy_ddns
# Add entrypoint # Add entrypoint
COPY --from=builder /usr/src/godaddy_ddns/docker/entrypoint.sh /entrypoint.sh COPY --from=builder /usr/src/docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
CMD ["/entrypoint.sh"] CMD ["/entrypoint.sh"]