Skip to content

Commit

Permalink
Merge pull request #83 from baler-compressor/77-building-docker-image…
Browse files Browse the repository at this point in the history
…-fails-on-m1

closes #77
  • Loading branch information
fritjof-b committed Feb 8, 2023
2 parents 05b16d8 + 9b941cb commit aac7f0d
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions Dockerfile.arm
@@ -0,0 +1,60 @@
# Based on https://github.com/michaeloliverx/python-poetry-docker-example/blob/master/docker/Dockerfile

## -----------------------------------------------------------------------------
## Base image with VENV

FROM arm64v8/python as python-base

# Configure environment
ENV PYTHONUNBUFFERED=1 \
PYTHONFAULTHANDLER=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1 \
PYSETUP_PATH="/baler-root/baler" \
VENV_PATH="/baler-root/baler/.venv"

ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"

RUN apt-get -y update; apt-get -y install curl

# System deps:
RUN curl -sSL https://install.python-poetry.org | python3 -

# Copy only requirements to cache them in docker layer
WORKDIR $PYSETUP_PATH
COPY ./poetry.lock ./pyproject.toml ./

# Project initialization:
RUN poetry install --no-interaction --no-ansi --only-root

# Creating folders, and files for the project:
COPY ./baler/ __init__.py README.md ./tests/ ./

# Creating python wheel
RUN poetry build

## -----------------------------------------------------------------------------
## Baler layer

FROM python:3.8-slim

# Copy virtual environment
WORKDIR /baler-root/baler
COPY --from=python-base /baler-root/baler/dist/*.whl ./

# Install wheel
RUN pip install *.whl

# Copy source
COPY --from=python-base /baler-root/baler/modules/ ./modules
COPY --from=python-base /baler-root/baler/*.py /baler-root/baler/README.md ./

# Configure run time
ENV PYTHONUNBUFFERED=1
WORKDIR /baler-root/
ENTRYPOINT ["python", "baler"]

0 comments on commit aac7f0d

Please sign in to comment.