Skip to content

Commit

Permalink
Adding a base image for use with CI/CD pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrizzell committed Jan 1, 2025
1 parent bccfef8 commit 7a94a42
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM debian:12-slim as build
FROM debian:12-slim AS build
ARG VERSION=9.2.1
ARG VARIANT=container
ARG MICROPYPATH=/ciruitpy/lib

# Install system requirements
RUN apt update \
Expand All @@ -20,16 +19,18 @@ COPY variants/ /circuitpython/ports/unix/variants/
RUN make -C mpy-cross \
&& VARIANT=$VARIANT BUILD=build make -C ports/unix

# Create final runtime container
FROM debian:12-slim
# Create a base image primarily for CI/CD pipelines runners
FROM debian:12-slim AS base
COPY --from=build /circuitpython/mpy-cross/build/mpy-cross /usr/local/bin/mpy-cross
COPY --from=build /circuitpython/ports/unix/build/micropython /usr/local/bin/micropython
# Setup non-root runtime user
ENTRYPOINT ["/usr/local/bin/micropython"]

# Set up non-root runtime user for everyone else
FROM base AS runtime
RUN useradd -Md /circuitpy circuitpy \
&& mkdir /circuitpy \
&& chown circuitpy:circuitpy /circuitpy
USER circuitpy
WORKDIR /circuitpy
# Load libraries from the working directory
ENV MICROPYPATH=$MICROPYPATH
ENTRYPOINT ["/usr/local/bin/micropython"]
ENV MICROPYPATH=/ciruitpy/lib

0 comments on commit 7a94a42

Please sign in to comment.