-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UBI Dockerfiles and put the old alpine ones back
Signed-off-by: Tom George <[email protected]>
- Loading branch information
Showing
4 changed files
with
145 additions
and
35 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
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,67 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2019-2020 Red Hat, Inc. | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
|
||
FROM registry.redhat.io/ubi8/ubi-minimal:8.3 | ||
|
||
ENV USER=user \ | ||
UID=12345 \ | ||
GROUP=group \ | ||
GID=23456 | ||
|
||
ADD content_sets_centos8.repo /etc/yum.repos.d/ | ||
|
||
#cron task not work in openshift in case https://github.com/gliderlabs/docker-alpine/issues/381 | ||
#so will used supercronic https://github.com/aptible/supercronic | ||
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.9/supercronic-linux-amd64 \ | ||
SUPERCRONIC=supercronic-linux-amd64 \ | ||
SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85 | ||
|
||
COPY cron/backup-cron-job /etc/crontabs/backup-cron-job | ||
COPY scripts /scripts | ||
# | ||
# Add user that will be able to start watcher binary but nothing more | ||
# the result will be propagated then into scratch image | ||
# See https://stackoverflow.com/a/55757473/12429735RUN | ||
# | ||
RUN microdnf update -y \ | ||
&& microdnf install -y \ | ||
shadow-utils \ | ||
rsync \ | ||
curl \ | ||
openssh \ | ||
openssh-clients \ | ||
ca-certificates \ | ||
&& microdnf clean all \ | ||
&& rm -rf /var/cache/yum \ | ||
&& groupadd -g "$GID" "$GROUP" \ | ||
&& useradd --uid "$UID" \ | ||
--comment "" \ | ||
--home-dir "$(pwd)" \ | ||
--no-create-home \ | ||
"$USER" \ | ||
&& mkdir /var/run/sshd && \ | ||
# Change permissions to let any arbitrary user | ||
for f in "/etc/passwd" "/var/run/sshd" "/scripts"; do \ | ||
echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ | ||
chmod -R g+rwX ${f}; \ | ||
done \ | ||
&& update-ca-trust \ | ||
#install supercronic | ||
&& curl -fsSLO "$SUPERCRONIC_URL" \ | ||
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ | ||
&& chmod +x "$SUPERCRONIC" \ | ||
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ | ||
&& ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic \ | ||
# change permissions | ||
&& chmod +x /scripts/* \ | ||
&& chmod 0644 /etc/crontabs/backup-cron-job \ | ||
&& sed -i s/root:!/"root:*"/g /etc/shadow | ||
|
||
EXPOSE 4445 | ||
ENTRYPOINT [ "/scripts/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
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,37 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2019-2020 Red Hat, Inc. | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
|
||
FROM registry.redhat.io/ubi8/ubi-minimal:8.3 | ||
|
||
ADD content_sets_centos8.repo /etc/yum.repos.d/ | ||
COPY entrypoint.sh /usr/local/bin | ||
|
||
RUN mkdir /etc/ssh /var/run/sshd /.ssh \ | ||
&& microdnf update -y \ | ||
&& microdnf install -y \ | ||
rsync \ | ||
openssh-server \ | ||
ca-certificates \ | ||
passwd \ | ||
&& touch /.ssh/known_hosts \ | ||
&& rm -rf /var/cache/yum /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_dsa_key \ | ||
# Change permissions to let any arbitrary user | ||
&& for f in "/etc/ssh" "/etc/passwd" "/.ssh" "/var/run/sshd" ; do \ | ||
echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ | ||
chmod -R g+rwX ${f}; \ | ||
done \ | ||
&& update-ca-trust \ | ||
&& chmod 0550 /.ssh \ | ||
&& chmod 0777 /.ssh/known_hosts \ | ||
&& sed -i s/root:!/"root:*"/g /etc/shadow \ | ||
&& chmod +x /usr/local/bin/entrypoint.sh | ||
|
||
COPY sshd_config /etc/ssh/sshd_config | ||
EXPOSE 2222 | ||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] |