-
-
Notifications
You must be signed in to change notification settings - Fork 1
Dockerfile updates #432
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
Dockerfile updates #432
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9c09737
Dockerfile updates
lfrancke 3c65a89
Fix template strings to use {[ and }]
lfrancke d101190
Merge branch 'main' into feat/docker-user
lfrancke a79b013
Merge branch 'main' into feat/docker-user
lfrancke 9f90926
Update hadolint
lfrancke 67f8e9c
Add docker syntax directive and a validation check
lfrancke 82e453d
Add comment for hadolint
lfrancke 0aa3e30
Merge branch 'main' into feat/docker-user
lfrancke 387dd93
Merge branch 'main' into feat/docker-user
lfrancke 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
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 |
---|---|---|
@@ -1,31 +1,90 @@ | ||
# syntax=docker/dockerfile:1.10.0@sha256:865e5dd094beca432e8c0a1d5e1c465db5f998dca4e439981029b3b81fb39ed5 | ||
# ============= | ||
# This file is automatically generated from the templates in stackabletech/operator-templating | ||
# DON'T MANUALLY EDIT THIS FILE | ||
# ============= | ||
# NOTE: The syntax directive needs to be the first line in a Dockerfile | ||
# https://docs.docker.com/build/checks/#fail-build-on-check-violations | ||
# check=error=true | ||
FROM oci.stackable.tech/sdp/ubi9-rust-builder AS builder | ||
|
||
FROM registry.access.redhat.com/ubi9/ubi-minimal AS operator | ||
|
||
ARG VERSION | ||
ARG RELEASE="1" | ||
|
||
LABEL name="Stackable Operator for {[ operator.pretty_string }]" \ | ||
maintainer="[email protected]" \ | ||
vendor="Stackable GmbH" \ | ||
version="${VERSION}" \ | ||
release="${RELEASE}" \ | ||
summary="Deploy and manage {[ operator.pretty_string }] clusters." \ | ||
description="Deploy and manage {[ operator.pretty_string }] clusters." | ||
# These are chosen at random and are this high on purpose to have very little chance to clash with an existing user or group on the host system | ||
ARG STACKABLE_USER_GID="574654813" | ||
ARG STACKABLE_USER_UID="782252253" | ||
|
||
# These labels have mostly been superceded by the OpenContainer spec annotations below but it doesn't hurt to include them | ||
# http://label-schema.org/rc1/ | ||
LABEL name="Stackable Operator for {[ operator.pretty_string }]" | ||
LABEL maintainer="[email protected]" | ||
LABEL vendor="Stackable GmbH" | ||
LABEL version="${VERSION}" | ||
LABEL release="${RELEASE}" | ||
LABEL summary="Deploy and manage {[ operator.pretty_string }] clusters." | ||
LABEL description="Deploy and manage {[ operator.pretty_string }] clusters." | ||
|
||
# Overwriting/Pinning UBI labels | ||
# https://github.com/projectatomic/ContainerApplicationGenericLabels | ||
LABEL vcs-ref="" | ||
LABEL distribution-scope="public" | ||
LABEL url="https://stackable.tech" | ||
ARG TARGETARCH | ||
LABEL architecture="${TARGETARCH}" | ||
LABEL com.redhat.component="" | ||
# It complains about it being an invalid label but RedHat uses it and we want to override it and it works.... | ||
# hadolint ignore=DL3048 | ||
LABEL com.redhat.license_terms="" | ||
LABEL io.buildah.version="" | ||
LABEL io.openshift.expose-services="" | ||
|
||
# https://github.com/opencontainers/image-spec/blob/036563a4a268d7c08b51a08f05a02a0fe74c7268/annotations.md#annotations | ||
LABEL org.opencontainers.image.authors="[email protected]" | ||
LABEL org.opencontainers.image.url="https://stackable.tech" | ||
LABEL org.opencontainers.image.vendor="Stackable GmbH" | ||
LABEL org.opencontainers.image.licenses="OSL-3.0" | ||
LABEL org.opencontainers.image.documentation="https://docs.stackable.tech/home/stable/{[ operator.product_string }]/" | ||
LABEL org.opencontainers.image.version="${VERSION}" | ||
LABEL org.opencontainers.image.revision="${RELEASE}" | ||
LABEL org.opencontainers.image.title="Stackable Operator for {[ operator.pretty_string }]" | ||
LABEL org.opencontainers.image.description="Deploy and manage {[ operator.pretty_string }] clusters." | ||
|
||
# https://docs.openshift.com/container-platform/4.16/openshift_images/create-images.html#defining-image-metadata | ||
# https://github.com/projectatomic/ContainerApplicationGenericLabels/blob/master/vendor/redhat/labels.md | ||
LABEL io.openshift.tags="ubi9,stackable,sdp,{[ operator.product_string }]" | ||
LABEL io.k8s.description="Deploy and manage {[ operator.pretty_string }] clusters." | ||
LABEL io.k8s.display-name="Stackable Operator for {[ operator.pretty_string }]" | ||
|
||
# Update image and install kerberos client libraries | ||
# install_weak_deps in microdnf does not support the literal "False" as dnf does | ||
# https://github.com/rpm-software-management/microdnf/blob/a600c62f29262d71a6259b70dc220df65a2ab9b5/dnf/dnf-main.c#L176-L189 | ||
RUN microdnf update -y --setopt=install_weak_deps=0 \ | ||
&& microdnf install -y --setopt=install_weak_deps=0 \ | ||
krb5-libs \ | ||
libkadm5 \ | ||
&& microdnf clean all \ | ||
&& rm -rf /var/cache/yum | ||
RUN <<EOF | ||
microdnf update | ||
microdnf install -y \ | ||
krb5-libs \ | ||
libkadm5 \ | ||
shadow-utils | ||
|
||
groupadd --gid ${STACKABLE_USER_GID} --system ${STACKABLE_USER_NAME} | ||
# The --no-log-init is required to work around a bug/problem in Go/Docker when very large UIDs are used | ||
# See https://github.com/moby/moby/issues/5419#issuecomment-41478290 for more context | ||
# Making this a system user prevents a mail dir from being created, expiry of passwords etc. but it will warn: | ||
# useradd warning: stackable's uid 1000 is greater than SYS_UID_MAX 999 | ||
# We can safely ignore this warning, to get rid of the warning we could change /etc/login.defs but that does not seem worth it | ||
# We'll leave the home directory hardcoded to /stackable because I don't want to deal with which chars might be valid and which might not in user name vs. directory | ||
useradd \ | ||
--no-log-init \ | ||
--gid ${STACKABLE_USER_GID} \ | ||
--uid ${STACKABLE_USER_UID} \ | ||
--system \ | ||
--create-home \ | ||
--home-dir /stackable \ | ||
stackable | ||
microdnf remove shadow-utils | ||
microdnf clean all | ||
rm -rf /var/cache/yum | ||
EOF | ||
|
||
COPY LICENSE /licenses/LICENSE | ||
|
||
|
@@ -34,9 +93,7 @@ COPY --from=builder /app/* /usr/local/bin/ | |
COPY deploy/config-spec/properties.yaml /etc/stackable/{[ operator.name }]/config-spec/properties.yaml | ||
{[% endif %}] | ||
|
||
RUN groupadd -g 1000 stackable && adduser -u 1000 -g stackable -c 'Stackable Operator' stackable | ||
|
||
USER stackable:stackable | ||
USER ${STACKABLE_USER_UID} | ||
|
||
ENTRYPOINT ["stackable-{[ operator.name }]"] | ||
CMD ["run"] |
Oops, something went wrong.
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.