-
-
Notifications
You must be signed in to change notification settings - Fork 6
Use check permissions script and consolidation #1054
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
692c066
consolidate docker image with fix image size PRs
maltesander b1fcb9d
adapted changelog
maltesander 9c8db9d
fix comment
maltesander 970d43e
fix intendation
maltesander 0a03e12
Merge remote-tracking branch 'origin/main' into fix/airflow-fix-size-…
maltesander b5c0334
improve check permissions script performance (@siggi)
maltesander 62a5319
Merge remote-tracking branch 'origin/main' into fix/airflow-fix-size-…
maltesander File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ ARG PRODUCT | |
| ARG STATSD_EXPORTER | ||
| ARG PYTHON | ||
| ARG TARGETARCH | ||
| ARG STACKABLE_USER_UID | ||
|
|
||
| COPY airflow/constraints-${PRODUCT}-python${PYTHON}.txt /tmp/constraints.txt | ||
| COPY --from=opa-auth-manager-builder /tmp/opa-auth-manager/dist/opa_auth_manager-0.1.0-py3-none-any.whl /tmp/ | ||
|
|
@@ -85,9 +86,17 @@ else | |
| end)' /tmp/sbom.json > /stackable/app/airflow-${PRODUCT}.cdx.json | ||
| EOF | ||
|
|
||
| WORKDIR /stackable | ||
| COPY --from=statsd_exporter-builder /statsd_exporter/statsd_exporter /stackable/statsd_exporter | ||
| COPY --from=statsd_exporter-builder /statsd_exporter/statsd_exporter-${STATSD_EXPORTER}.cdx.json /stackable/statsd_exporter-${STATSD_EXPORTER}.cdx.json | ||
| COPY --from=gitsync-image --chown=${STACKABLE_USER_UID}:0 /git-sync /stackable/git-sync | ||
|
|
||
| RUN <<EOF | ||
| mkdir -pv /stackable/airflow | ||
| mkdir -pv /stackable/airflow/dags | ||
| mkdir -pv /stackable/airflow/logs | ||
| chmod --recursive g=u /stackable | ||
| EOF | ||
|
|
||
|
|
||
| FROM stackable/image/vector AS airflow-main-image | ||
|
|
||
|
|
@@ -99,22 +108,26 @@ ARG TARGETARCH | |
| ARG STACKABLE_USER_UID | ||
|
|
||
| LABEL name="Apache Airflow" \ | ||
| maintainer="[email protected]" \ | ||
| vendor="Stackable GmbH" \ | ||
| version="${PRODUCT}" \ | ||
| release="${RELEASE}" \ | ||
| summary="The Stackable image for Apache Airflow." \ | ||
| description="This image is deployed by the Stackable Operator for Apache Airflow." | ||
|
|
||
| COPY airflow/licenses /licenses | ||
| COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/utils/entrypoint.sh /entrypoint.sh | ||
| COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/utils/run-airflow.sh /run-airflow.sh | ||
| maintainer="[email protected]" \ | ||
| vendor="Stackable GmbH" \ | ||
| version="${PRODUCT}" \ | ||
| release="${RELEASE}" \ | ||
| summary="The Stackable image for Apache Airflow." \ | ||
| description="This image is deployed by the Stackable Operator for Apache Airflow." | ||
|
|
||
| ENV HOME=/stackable | ||
| ENV AIRFLOW_USER_HOME_DIR=/stackable | ||
| ENV PATH=$PATH:/bin:$HOME/app/bin | ||
| ENV AIRFLOW_HOME=$HOME/airflow | ||
|
|
||
| COPY --from=airflow-build-image --chown=${STACKABLE_USER_UID}:0 /stackable/ ${HOME}/ | ||
| COPY --from=airflow-build-image --chown=${STACKABLE_USER_UID}:0 /stackable/git-sync ${HOME}/git-sync | ||
|
|
||
| COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/utils/entrypoint.sh /entrypoint.sh | ||
| COPY --chown=${STACKABLE_USER_UID}:0 airflow/stackable/utils/run-airflow.sh /run-airflow.sh | ||
|
|
||
| COPY airflow/licenses /licenses | ||
|
|
||
| # Update image and install needed packages | ||
| RUN <<EOF | ||
| microdnf update | ||
|
|
@@ -142,33 +155,33 @@ rm -rf /var/cache/yum | |
| # Get the correct `tini` binary for our architecture. | ||
| # It is used as an init alternative in the entrypoint | ||
| curl -o /usr/bin/tini "https://repo.stackable.tech/repository/packages/tini/tini-${TINI}-${TARGETARCH}" | ||
|
|
||
| # fix missing permissions | ||
| chmod a+x /entrypoint.sh | ||
| chmod a+x /run-airflow.sh | ||
| chmod +x /usr/bin/tini | ||
| EOF | ||
|
|
||
| mkdir -pv ${AIRFLOW_HOME} | ||
| mkdir -pv ${AIRFLOW_HOME}/dags | ||
| mkdir -pv ${AIRFLOW_HOME}/logs | ||
| # ---------------------------------------- | ||
| # Checks | ||
| # This section is to run final checks to ensure the created final images | ||
| # adhere to several minimal requirements like: | ||
| # - check file permissions and ownerships | ||
| # ---------------------------------------- | ||
|
|
||
| # All files and folders owned by root to support running as arbitrary users | ||
| # This is best practice as all container users will belong to the root group (0) | ||
| chown -R ${STACKABLE_USER_UID}:0 /stackable | ||
| chmod -R g=u /stackable | ||
| # Check that permissions and ownership in ${HOME} are set correctly | ||
| # This will fail and stop the build if any mismatches are found. | ||
| RUN <<EOF | ||
| /bin/check-permissions-ownership.sh ${HOME} ${STACKABLE_USER_UID} 0 | ||
| EOF | ||
|
|
||
| # ---------------------------------------- | ||
| # Attention: We are changing the group of all files in /stackable directly above | ||
| # If you do any file based actions (copying / creating etc.) below this comment you | ||
| # absolutely need to make sure that the correct permissions are applied! | ||
| # chown ${STACKABLE_USER_UID}:0 | ||
| # Attention: Do not perform any file based actions (copying/creating etc.) below this comment because the permissions would not be checked. | ||
| # ---------------------------------------- | ||
|
|
||
| USER ${STACKABLE_USER_UID} | ||
| WORKDIR /stackable | ||
|
|
||
| COPY --from=airflow-build-image --chown=${STACKABLE_USER_UID}:0 /stackable/ ${HOME}/ | ||
| COPY --from=gitsync-image --chown=${STACKABLE_USER_UID}:0 /git-sync /stackable/git-sync | ||
|
|
||
| ENTRYPOINT ["/usr/bin/tini", "--", "/run-airflow.sh"] | ||
| CMD [] | ||
|
|
||
|
|
||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.