Skip to content

Commit

Permalink
Clean up naming supervisord-image -> init-image (redhat-developer#29)
Browse files Browse the repository at this point in the history
* rename odo-supervisord-image to odo-init-image

* add com.redhat.component label
  • Loading branch information
kadel authored and openshift-merge-robot committed Aug 28, 2019
1 parent 21ecb5b commit a3afbfd
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 42 deletions.
65 changes: 27 additions & 38 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,57 +1,46 @@
#
# This is an "initContainer" image using the base "source-to-image" OpenShift template
# in order to appropriately inject the supervisord binary into the application container.
# This is an "initContainer" image used by odo to inject required tools for odo to work properly.
#

# SUPERVISORD

# Build SupervisordD
FROM registry.svc.ci.openshift.org/openshift/release:golang-1.11 AS supervisordbuilder

RUN mkdir -p /go/src/github.com/ochinchina/supervisord

ADD vendor/supervisord /go/src/github.com/ochinchina/supervisord

WORKDIR /go/src/github.com/ochinchina/supervisord

RUN mkdir -p /go/src/github.com/ochinchina/supervisord
COPY vendor/supervisord /go/src/github.com/ochinchina/supervisord
RUN go build -o /tmp/supervisord

# DUMB INIT
# Build dumb-init
FROM registry.access.redhat.com/ubi7/ubi AS dumbinitbuilder

RUN yum -y install gcc make binutils

ADD vendor/dumb-init /tmp/dumb-init-src

WORKDIR /tmp/dumb-init-src

RUN yum -y install gcc make binutils
COPY vendor/dumb-init /tmp/dumb-init-src
RUN gcc -std=gnu99 -s -Wall -Werror -O3 -o dumb-init dumb-init.c

# Actual image

# Final image
FROM registry.access.redhat.com/ubi7/ubi

ENV SUPERVISORD_DIR /opt/supervisord

COPY --from=dumbinitbuilder /tmp/dumb-init-src/dumb-init ${SUPERVISORD_DIR}/bin/dumb-init

RUN chmod +x ${SUPERVISORD_DIR}/bin/dumb-init
LABEL com.redhat.component=atomic-openshift-odo-init-image

RUN mkdir -p ${SUPERVISORD_DIR}/conf ${SUPERVISORD_DIR}/bin
ENV ODO_TOOLS_DIR /opt/odo-init/

ADD supervisor.conf ${SUPERVISORD_DIR}/conf/
ADD vendor/fix-permissions /usr/bin/fix-permissions
RUN chmod +x /usr/bin/fix-permissions
# dumb-init
COPY --from=dumbinitbuilder /tmp/dumb-init-src/dumb-init ${ODO_TOOLS_DIR}/bin/dumb-init
RUN chmod +x ${ODO_TOOLS_DIR}/bin/dumb-init

COPY --from=supervisordbuilder /tmp/supervisord ${SUPERVISORD_DIR}/bin/supervisord
# SupervisorD
RUN mkdir -p ${ODO_TOOLS_DIR}/conf ${ODO_TOOLS_DIR}/bin
COPY supervisor.conf ${ODO_TOOLS_DIR}/conf/
COPY --from=supervisordbuilder /tmp/supervisord ${ODO_TOOLS_DIR}/bin/supervisord

ADD assemble-and-restart ${SUPERVISORD_DIR}/bin
# ADD assemble ${SUPERVISORD_DIR}/bin
# RUN ${SUPERVISORD_DIR}/bin/assemble
ADD run ${SUPERVISORD_DIR}/bin
ADD s2i-setup ${SUPERVISORD_DIR}/bin
ADD setup-and-run ${SUPERVISORD_DIR}/bin
# wrapper scrips
COPY assemble-and-restart ${ODO_TOOLS_DIR}/bin
COPY run ${ODO_TOOLS_DIR}/bin
COPY s2i-setup ${ODO_TOOLS_DIR}/bin
COPY setup-and-run ${ODO_TOOLS_DIR}/bin
COPY vendor/fix-permissions /usr/bin/fix-permissions

RUN chgrp -R 0 ${SUPERVISORD_DIR} && \
chmod -R g+rwX ${SUPERVISORD_DIR} && \
chmod -R 666 ${SUPERVISORD_DIR}/conf/* && \
chmod 775 ${SUPERVISORD_DIR}/bin/supervisord
RUN chgrp -R 0 ${ODO_TOOLS_DIR} && \
chmod -R g+rwX ${ODO_TOOLS_DIR} && \
chmod -R 666 ${ODO_TOOLS_DIR}/conf/* && \
chmod 775 ${ODO_TOOLS_DIR}/bin/supervisord
2 changes: 1 addition & 1 deletion assemble-and-restart
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ fi

# Restart supervisord in order to actualy run the application
# This is a dumb way to start as supervisord does not have a restart function
/var/lib/supervisord/bin/supervisord ctl stop run; /var/lib/supervisord/bin/supervisord ctl start run
/opt/odo/bin/supervisord ctl stop run; /opt/odo/bin/supervisord ctl start run
4 changes: 2 additions & 2 deletions setup-and-run
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -x
set -eo pipefail

echo "Setting up"
/var/lib/supervisord/bin/s2i-setup
/opt/odo/bin/s2i-setup

echo "Running"
/var/lib/supervisord/bin/run
/opt/odo/bin/run
2 changes: 1 addition & 1 deletion supervisor.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[program:run]
command = /var/lib/supervisord/bin/setup-and-run
command = /opt/odo/bin/setup-and-run
stdout_logfile=/dev/stdout
stdout_events_enabled=true
stderr_logfile=/dev/stderr
Expand Down

0 comments on commit a3afbfd

Please sign in to comment.