This repository has been archived by the owner on May 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathDockerfile.rhel7
58 lines (46 loc) · 2.06 KB
/
Dockerfile.rhel7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# playbook2image
FROM rhscl/python-27-rhel7:2.7
MAINTAINER Aaron Weitekamp <[email protected]>
# TODO: Rename the builder environment variable to inform users about application you provide them
# ENV BUILDER_VERSION 1.0
LABEL io.k8s.description="Ansible playbook to image builder" \
io.k8s.display-name="playbook2image" \
io.openshift.tags="builder,ansible,playbook" \
io.openshift.expose-services="" \
url="https://github.com/aweiteka/playbook2image/blob/master/README.md" \
name="playbook2image" \
summary="Ansible playbook to image builder" \
description="Base image to to ship Ansible playbooks as self-executing container image." \
com.redhat.component="playbook2image-docker" \
vcs-url="https://github.com/aweiteka/playbook2image" \
vcs-type="git" \
version="0.0.1"
# Install Ansible.
#
# The default Dockerfile also installs 'pip' and 'python-devel' so that the
# builder image can install Python dependencies if the playbooks need them. In
# the productized version these are provided by the python-27-rhel7 base image,
# and dependencies should be packaged and installed with yum instead
USER root
# To use a subscription inside container yum command has to be run first (before
# yum-config-manager) https://access.redhat.com/solutions/1443553
RUN yum repolist > /dev/null && \
yum-config-manager --enable rhel-7-server-ose-3.4-rpms && \
yum install -y --setopt=tsflags=nodocs ansible && \
yum clean all -y
COPY ./.s2i/bin/ /usr/libexec/s2i
COPY user_setup /tmp
ENV APP_ROOT=/opt/app-root
ENV USER_NAME=default \
USER_UID=1001 \
APP_HOME=${APP_ROOT}/src \
HOME=${APP_ROOT}/src \
PATH=$PATH:${APP_ROOT}/bin
RUN mkdir -p ${APP_HOME} ${APP_ROOT}/etc ${APP_ROOT}/bin
RUN chmod -R ug+x ${APP_ROOT}/bin ${APP_ROOT}/etc /tmp/user_setup && \
/tmp/user_setup
# Back to the UID used in the base image
USER ${USER_UID}
RUN sed "s@${USER_NAME}:x:${USER_UID}:0@${USER_NAME}:x:\${USER_ID}:\${GROUP_ID}@g" /etc/passwd > ${APP_ROOT}/etc/passwd.template
WORKDIR ${APP_HOME}
CMD ["/usr/libexec/s2i/usage"]