Update Shipyard Dockerfile

This P.S. will allow user to execute Shipyard CLI using a
Shipyard docker container.

The updates made to the Dockerfile and entrypoint.sh are
aligned with those in Armada and Drydock.

Change-Id: I59ccd2d41fab19781f51334cb1a69b69a48d3c49
This commit is contained in:
Anthony Lin 2017-12-22 16:18:48 +00:00
parent 6994db10ca
commit 13f9adfa53
3 changed files with 53 additions and 16 deletions

View File

@ -171,6 +171,29 @@ response::
the value that Keystone returns when service lookup is done for the public
URL for Shipyard.
Running Shipyard CLI with Docker Container
------------------------------------------
It is also possible to execute Shipyard CLI using docker container
Note that we will need to pass the relevant environment information as well
as the Shipyard command that we wish to execute as part of the ``docker run``
command. In this example we will execute the ``get actions`` command::
sudo docker run -e 'OS_AUTH_URL=http://keystone-api.ucp.svc.cluster.local:80/v3' \
-e 'OS_PASSWORD=password' -e 'OS_PROJECT_DOMAIN_NAME=default' \
-e 'OS_PROJECT_NAME=service' -e 'OS_USERNAME=shipyard' \
-e 'OS_USER_DOMAIN_NAME=default' -e 'OS_IDENTITY_API_VERSION=3' \
--rm --net=host attcomdev/shipyard:latest get actions
The output will resemble the following::
+ CMD=shipyard
+ PORT=9000
+ '[' get = server ']'
+ exec shipyard get actions
Name Action Lifecycle
deploy_site action/01C1Z4HQM8RFG823EQT3EAYE4X Processing
Use Case: Ingest Site Design
----------------------------
Shipyard serves as the entrypoint for a deployment of the Undercloud Platform

View File

@ -14,10 +14,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Start shipyard application
exec uwsgi \
--http :9000 \
--paste config:/etc/shipyard/api-paste.ini \
--enable-threads \
-L \
--pyargv "--config-file /etc/shipyard/shipyard.conf"
set -ex
CMD="shipyard"
PORT="9000"
if [ "$1" = 'server' ]; then
# Start shipyard application
exec uwsgi \
--http :${PORT} \
--paste config:/etc/shipyard/api-paste.ini \
--enable-threads \
-L \
--pyargv "--config-file /etc/shipyard/shipyard.conf"
else
# Execute shipyard command
exec ${CMD} $@
fi

View File

@ -16,6 +16,8 @@ FROM ubuntu:16.04
ENV DEBIAN_FRONTEND noninteractive
ENV container docker
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
RUN set -x && \
apt-get -qq update && \
@ -47,15 +49,17 @@ RUN set -x && \
/usr/share/doc \
/usr/share/doc-base
# Copy dependency requirements
COPY ./requirements.txt /tmp/
RUN pip3 install -r /tmp/requirements.txt
# Create shipyard user
RUN useradd -ms /bin/bash shipyard
# Clone the shipyard repository
COPY ./ /home/shipyard/shipyard
COPY . /home/shipyard/shipyard
# Set work directory
# Install dependency requirements and packages
WORKDIR /home/shipyard/shipyard
RUN pip3 install -r requirements.txt
RUN python3 setup.py install
# Copy entrypoint.sh to /home/shipyard
COPY entrypoint.sh /home/shipyard/entrypoint.sh
@ -64,13 +68,13 @@ COPY entrypoint.sh /home/shipyard/entrypoint.sh
RUN chown -R shipyard: /home/shipyard \
&& chmod +x /home/shipyard/entrypoint.sh
# Set user to shipyard
USER shipyard
# Expose port 9000 for application
EXPOSE 9000
# Set work directory
USER shipyard
WORKDIR /home/shipyard/shipyard
# Execute entrypoint
ENTRYPOINT ["/home/shipyard/entrypoint.sh"]
CMD ["server"]