Skip to content

Commit

Permalink
Update Dockerfile to be cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlovelltroy committed May 6, 2024
1 parent 7297e35 commit 7cf9f0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/ && \
Expand Down
20 changes: 7 additions & 13 deletions Dockerfile.updater
Original file line number Diff line number Diff line change
@@ -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"]
ENTRYPOINT ["python", "/app/dnsmasq_updater.py"]

0 comments on commit 7cf9f0b

Please sign in to comment.