<\/path><\/svg><\/a><\/div>\n# Base image Example\n\n# ----------------\n#############################################\n# Temp image to build the prerequisites \n#############################################\nFROM registry.access.redhat.com/ubi8/ubi:latest AS builder\n\nRUN groupadd -g 1001 appuser && \\\nuseradd -m -s /sbin/nologin -u 1001 -g appuser appuser\n\n#############################################\n# Container Image\n#############################################\nFROM registry.access.redhat.com/ubi8/ubi-minimal:latest\nMAINTAINER Dev4Devs <dev4devs@gmail.com>\n\n# Define Labels\nLABEL name=\"my.dev4devs-com/docker-multi-stages-build-image\" \\\nmaintainer=\"dev4devs@gmail.com\" \\\nvendor=\"Dev4Devs\" \n\n# Define EnvVars\nENV APP=/usr/local/bin/app \\\nUSER_UID=1001 \\\nUSER_NAME=appuser \\\nUSER_HOME=/home/appuser \n\n# Copy group and user created in the builder image\nCOPY --from=builder /etc/passwd /tmp\nCOPY --from=builder /etc/group /tmp\n\n# Create the user and group in this image and add permissions \nRUN cat /tmp/passwd | grep \${USER_NAME} >> /etc/passwd \\\n&& cat /tmp/group | grep \${USER_NAME} >> /etc/group \\\n&& mkdir -p \${USER_HOME} \\\n&& chown -R \${USER_NAME}:\${USER_NAME} \${USER_HOME} \\\n&& chmod ug+rwx \${USER_HOME} \\\n&& rm -rf /tmp/passwd \\\n&& rm -rf /tmp/group\n\n# Use the user created to run the container as rootless\nUSER \${USER_UID}\n\n# Installs the operator binary\nCOPY build/_output/bin/\${USER_NAME} \${PROXY}\nCOPY build/bin /usr/local/bin\n\n# This allows the Platform to validate the authority the image\n# More info: https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html#openshift-specific-guidelines\nENTRYPOINT [\"/usr/local/bin/entrypoint\"]\n\n# Execute the operator \nCMD exec \${APP} \$@\n<\/code><\/pre>\n<\/article>\n <\/div>\n\n <\/div>\n<\/div>\n\n <\/div>\n