Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layer monobase:latest on top of monobase-runtime:latest #51

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- run: ./script/build-image
- run: ./script/build-runtime-image
- run: ./script/test

test-mini:
Expand Down
16 changes: 3 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ RUN if $(git rev-parse --is-shallow-repository); then git fetch --unshallow; fi
&& echo "SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION}" \
&& uv build --sdist --wheel

FROM ubuntu:jammy
FROM monobase-runtime:latest

ARG PREFIX=/srv/r8/monobase

ENV DEBIAN_FRONTEND=noninteractive
ENV MONOBASE_PREFIX=$PREFIX
ENV PATH=$MONOBASE_PREFIX/bin:$PATH
ENV PYTHONPATH=/opt/r8
ENV TZ=Etc/UTC
ENV UV_CACHE_DIR=$PREFIX/uv/cache
ENV UV_COMPILE_BYTECODE=true
ENV UV_LINK_MODE=hardlink
Expand All @@ -33,16 +29,10 @@ ENV UV_PYTHON_PREFERENCE=only-managed
ENV UV_TOOL_BIN_DIR=$PREFIX/bin
ENV UV_TOOL_DIR=$PREFIX/uv/tools

ADD ./apt-dependencies.txt /tmp/apt-dependencies.txt
RUN apt-get update \
&& apt-get install -y $(grep -v '^#' </tmp/apt-dependencies.txt) \
&& rm -rf /var/lib/apt/lists/* /tmp/apt-dependencies.txt

RUN --mount=type=bind,from=build,target=/tmp/build-layer,ro \
ln -sv /usr/bin/tini /sbin/tini \
&& mkdir -p /opt/r8/monobase /tmp/r8 \
mkdir -p /opt/r8/monobase /tmp/r8 \
&& tar --strip-components=1 -C /tmp/r8 -xf $(find /tmp/build-layer/src/dist -name '*.tar.gz' | head -1) \
&& cp -v /tmp/r8/src/monobase/*.sh /tmp/r8/src/monobase/pget /opt/r8/monobase/ \
&& cp -v /tmp/r8/src/monobase/build.sh /tmp/r8/src/monobase/pget /opt/r8/monobase/ \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only other *.shs are activate.sh & exec.sh

&& rsync -av /tmp/r8/src/monobase/requirements /opt/r8/monobase/ \
&& find /tmp/build-layer/src/dist/ -type f \
&& cp -v $(find /tmp/build-layer/src/dist/ -name '*.whl' | head -1) /opt/r8/ \
Expand Down
14 changes: 8 additions & 6 deletions runtime.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
FROM ubuntu:jammy

ARG PREFIX=/srv/r8/monobase

ENV DEBIAN_FRONTEND=noninteractive
ENV MONOBASE_PREFIX=/srv/r8/monobase
ENV MONOBASE_PREFIX=$PREFIX
ENV PATH=$MONOBASE_PREFIX/bin:$PATH
ENV TZ=Etc/UTC

ADD ./apt-dependencies.txt /tmp/apt-dependencies.txt
RUN apt-get update \
&& apt-get install -y $(grep -v '^#' </tmp/apt-dependencies.txt) \
&& rm -rf /var/lib/apt/lists/* /tmp/apt-dependencies.txt
RUN --mount=type=bind,src=.,dst=/src,ro \
apt-get update \
&& apt-get install -y $(grep -v '^#' </src/apt-dependencies.txt) \
&& rm -rf /var/lib/apt/lists/*

RUN --mount=type=bind,src=../../,dst=/src,ro \
RUN --mount=type=bind,src=.,dst=/src,ro \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what ../../ means, shouldn't it be . i.e. PWD of project root? Why did it work before?

ln -sv /usr/bin/tini /sbin/tini \
&& mkdir -p /opt/r8/monobase \
&& ls -la /src/ \
Expand Down
7 changes: 6 additions & 1 deletion script/build-image
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
set -euo pipefail

cd "$(git rev-parse --show-toplevel)"

# monobase-runtime
docker build --file runtime.Dockerfile --tag monobase-runtime:latest --platform=linux/amd64 .

# monobase is layered on top of monobase-runtime
rm -vf ./dist/monobase*.*
uv build --sdist --wheel
exec docker build --tag monobase:latest --platform=linux/amd64 .
docker build --tag monobase:latest --platform=linux/amd64 .
8 changes: 0 additions & 8 deletions script/build-runtime-image

This file was deleted.

Loading