-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use local source for installing bonfire (#427)
* feat: use local source for installing bonfire * add dockerignore and refactor to use multi-stage
- Loading branch information
1 parent
5068bea
commit b2e6cd7
Showing
2 changed files
with
41 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
* | ||
!.git | ||
!bonfire | ||
!utils | ||
!pyproject.toml | ||
!entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,44 @@ | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.10-1086 | ||
FROM registry.access.redhat.com/ubi9/python-312:1-25.1726664318 as builder | ||
|
||
ARG OC_CLI_VERSION=4.16 | ||
ENV OC_CLI_VERSION=4.16 | ||
|
||
RUN microdnf install python3.12 python3.12-pip shadow-utils tar gzip && \ | ||
COPY --chown=default:0 . . | ||
|
||
RUN pip install build | ||
RUN python -m build -o dist | ||
|
||
RUN curl -sSLO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest-$OC_CLI_VERSION/openshift-client-linux.tar.gz && \ | ||
tar -xzf openshift-client-linux.tar.gz oc kubectl && \ | ||
rm openshift-client-linux.tar.gz | ||
|
||
FROM registry.access.redhat.com/ubi9-minimal:9.4-1227.1726694542 | ||
|
||
ENV APP_ROOT=/opt/bonfire | ||
|
||
ENV PYTHON_VERSION=3.12 \ | ||
PATH=$APP_ROOT/.local/bin/:$PATH \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONIOENCODING=UTF-8 \ | ||
LANG=en_US.UTF-8 \ | ||
CNB_USER_ID=1001 \ | ||
CNB_GROUP_ID=0 \ | ||
PIP_NO_CACHE_DIR=off | ||
|
||
RUN microdnf install -y python3.12 python3.12-pip shadow-utils && \ | ||
microdnf clean all | ||
|
||
RUN groupadd -r -g 1000 bonfire && \ | ||
useradd -r -u 1000 -g bonfire -m -d /opt/bonfire -s /bin/bash bonfire | ||
RUN useradd -r -u 1001 -g 0 -m -d $APP_ROOT -s /bin/bash bonfire | ||
|
||
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest-$OC_CLI_VERSION/openshift-client-linux.tar.gz \ | ||
-o oc.tar.gz && \ | ||
tar -C /usr/bin/ -xvzf oc.tar.gz oc kubectl && \ | ||
rm -f oc.tar.gz | ||
USER 1001 | ||
WORKDIR $APP_ROOT | ||
|
||
USER bonfire | ||
WORKDIR /opt/bonfire | ||
ENV PATH="/opt/bonfire/.local/bin:$PATH" | ||
COPY --from=builder /opt/app-root/src/dist/crc_bonfire*.whl . | ||
|
||
RUN pip3 install crc-bonfire --user | ||
RUN bonfire config write-default | ||
RUN pip3.12 install crc_bonfire*.whl && rm crc_bonfire*.whl | ||
|
||
COPY --from=builder /opt/app-root/src/oc /opt/app-root/src/kubectl ${APP_ROOT}/.local/bin/ | ||
COPY entrypoint.sh . | ||
|
||
ENTRYPOINT ["/opt/bonfire/entrypoint.sh"] | ||
RUN bonfire config write-default | ||
|
||
ENTRYPOINT [ "./entrypoint.sh" ] |