From 7cf9f0bbe68d3b5cc8fa73d45bdecbde2d6ba433 Mon Sep 17 00:00:00 2001 From: Alex Lovell-Troy Date: Mon, 6 May 2024 10:32:44 -0400 Subject: [PATCH] Update Dockerfile to be cleaner --- Dockerfile | 8 +++++--- Dockerfile.updater | 20 +++++++------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index fe301e0..fba6f1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,11 @@ ## Build iPXE binaries from source FROM cgr.dev/chainguard/wolfi-base AS builder -RUN apk add git gcc binutils make perl xz xz-dev build-base && \ - git clone https://github.com/ipxe/ipxe.git -WORKDIR ipxe/src/ +RUN apk add git gcc binutils make perl xz xz-dev build-base +RUN mkdir -p /tmp +WORKDIR /tmp +RUN git clone https://github.com/ipxe/ipxe.git +WORKDIR /tmp/ipxe/src/ RUN make bin/undionly.kpxe && \ make bin-x86_64-efi/ipxe.efi && \ cp -a bin/undionly.kpxe /tmp/ && \ diff --git a/Dockerfile.updater b/Dockerfile.updater index a0680bb..a616643 100644 --- a/Dockerfile.updater +++ b/Dockerfile.updater @@ -1,29 +1,23 @@ # syntax=docker/dockerfile:1.4 +FROM cgr.dev/chainguard/python:latest-dev as builder -# Path: Dockerfile.updater -FROM cgr.dev/chainguard/python:latest-dev AS builder - -# Set working directory WORKDIR /app -# Copy only requirements file to install dependencies COPY requirements.txt . -# Install dependencies -RUN pip install --no-cache-dir -r requirements.txt +RUN pip install -r requirements.txt --user -# Stage 2: Use second python base image as the main container FROM cgr.dev/chainguard/python:latest -# Set working directory WORKDIR /app -# Copy dependencies from the builder stage -COPY --from=builder /usr/local/lib/python3.12/site-packages/ /usr/local/lib/python3.12/site-packages/ +# Make sure you update Python version in path +COPY --from=builder /home/nonroot/.local/lib/python3.12/site-packages /home/nonroot/.local/lib/python3.12/site-packages +COPY dnsmasq_updater.py . # Copy the rest of the application code -COPY smd.py /smd.py +COPY dnsmasq_updater.py . # Set the command to run your Python application -ENTRYPOINT ["python", "smd.py"] \ No newline at end of file +ENTRYPOINT ["python", "/app/dnsmasq_updater.py"] \ No newline at end of file