Skip to content

Commit

Permalink
docker: migrate to Poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
mochaaP committed Jan 8, 2024
1 parent b45d81e commit 0dad55c
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
FROM python:3.8-slim AS builder
FROM python:3-slim AS base

LABEL maintainer="Kevin Foo <chfl4gs@qiling.io>"
WORKDIR /qiling

# hadolint global ignore=DL3008,DL3013
ENV DEBIAN_FRONTEND=noninteractive
ENV AM_I_IN_A_DOCKER_CONTAINER Yes
ENV AM_I_IN_A_DOCKER_CONTAINER=True

RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get install -y --no-install-recommends cmake build-essential gcc git
RUN apt-get update && apt-get -y upgrade && rm -rf /var/lib/apt/lists/*


FROM base AS builder

COPY . /qiling
RUN apt-get update && apt-get install -y --no-install-recommends \
cmake build-essential gcc git \
&& rm -rf /var/lib/apt/lists/*

RUN cd /qiling \
&& pip wheel . -w wheels
COPY pyproject.toml poetry.lock ./
RUN pip3 install --no-cache-dir poetry \
&& poetry install --no-root --no-directory

FROM python:3.8-slim AS base
COPY qiling/ tests/ examples/ ./
RUN poetry install --no-dev && poetry build --format=wheel

FROM base

LABEL maintainer="Kevin Foo <chfl4gs@qiling.io>"

COPY --from=builder /qiling /qiling

WORKDIR /qiling

RUN apt-get update \
&& apt-get install -y --no-install-recommends unzip apt-utils \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-deps wheels/*.whl \
&& rm -rf wheels

ENV HOME /qiling
&& apt-get install -y --no-install-recommends unzip apt-utils \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-deps --no-cache-dir dist/*.whl \
&& rm -rf ./dist/

CMD bash
CMD ["bash"]

0 comments on commit 0dad55c

Please sign in to comment.