Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate container images to opensuse:42.3 base #1293

Merged
merged 7 commits into from
Oct 25, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions deploy/Dockerfile.bk-preflight.dev
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
FROM alpine:latest

RUN apk update && \
apk add ca-certificates openssl git &&\
mkdir -p /srv
FROM splatform/stratos-preflight-base:dev

RUN mkdir -p /srv
WORKDIR /srv
COPY outputs/* /srv/
COPY /deploy/db/scripts/run-preflight-job.sh /run-preflight-job.sh
COPY /deploy/tools/generate_cert.sh /generate_cert.sh
RUN chmod +x portal-proxy
EXPOSE 443
CMD ["sh", "-c", "/run-preflight-job.sh; /srv/portal-proxy"]
CMD ["bash", "-c", "/run-preflight-job.sh; /srv/portal-proxy"]
4 changes: 2 additions & 2 deletions deploy/Dockerfile.bk.build
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM splatform/stratos-bk-build-base
FROM splatform/stratos-bk-build-base:dev

RUN mkdir -p /go/src/github.com/SUSE/stratos-ui
WORKDIR /go/src/github.com/SUSE/stratos-ui
ENV GLIDE_HOME /.glide
COPY glide-cache /.glide
COPY npm-cache /root/.npm
COPY npm-cache/ /root/.npm
COPY compile.sh /
CMD ["/compile.sh"]
7 changes: 1 addition & 6 deletions deploy/Dockerfile.bk.dev
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
FROM alpine:latest
FROM splatform/stratos-bk-base:dev

RUN apk update && \
apk add ca-certificates git &&\
mkdir -p /srv

WORKDIR /srv
COPY outputs/* /srv/
COPY dev-certs dev-certs
RUN chmod +x portal-proxy
Expand Down
7 changes: 1 addition & 6 deletions deploy/Dockerfile.bk.k8s
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
FROM alpine:latest
FROM splatform/stratos-bk-base:dev

RUN apk update && \
apk add ca-certificates git &&\
mkdir -p /srv

WORKDIR /srv
COPY outputs/* /srv/
RUN chmod +x portal-proxy
EXPOSE 443
Expand Down
5 changes: 3 additions & 2 deletions deploy/Dockerfile.ui.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM node:6.9.1
FROM splatform/stratos-ui-base:dev


ARG USER_ID
ARG GROUP_ID
Expand All @@ -13,7 +14,7 @@ RUN user_exists=$(getent passwd ${USER_ID} | cut -d: -f1); \
echo "Group with gid ${GROUP_ID} already exists."; \
fi ;\
if [ -z "${user_exists}" ]; then \
useradd -m -r -g ${USER_NAME} -u ${USER_ID} ${USER_NAME}; \
useradd -m -r -g ${GROUP_ID} -u ${USER_ID} ${USER_NAME}; \
else \
echo "User with uid ${USER_ID} already exists."; \
fi
Expand Down
2 changes: 1 addition & 1 deletion deploy/build_portal_proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ docker run -it \
-e GROUP_ID=$(id -g) \
--name console-proxy-builder \
--volume $(pwd):/go/src/github.com/SUSE/stratos-ui \
splatform/stratos-proxy-builder:test $*
splatform/stratos-proxy-builder:dev $*

ret=$?
popd
Expand Down
19 changes: 0 additions & 19 deletions deploy/ci/scripts/build_goose_image.sh

This file was deleted.

4 changes: 2 additions & 2 deletions deploy/ci/tasks/stratos-ui/prep-proxy-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ platform: linux
image_resource:
type: docker-image
source:
repository: ci-registry.ngrok.io:80/susetest/console-proxy-builder
tag: "latest"
repository: ci-registry.ngrok.io:80/splatform/stratos-proxy-builder
tag: "dev"
insecure_registries: [ "ci-registry.ngrok.io:80" ]

inputs:
Expand Down
2 changes: 1 addition & 1 deletion deploy/ci/tasks/stratos-ui/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ run:

cat ../build/secrets.json

for image in splatform/stratos-goose postgres:latest nginx:1.11 splatform/stratos-uaa java:openjdk-8u66-jre alpine:latest splatform/stratos-concourse; do
for image in splatform/stratos-goose-base:dev splatform/stratos-bk-base:dev splatform/stratos-nginx-base:dev splatform/stratos-uaa splatform/stratos-concourse; do
docker pull ${REGISTRY_NAME}/$image
docker tag ${REGISTRY_NAME}/$image $image
done
Expand Down
8 changes: 0 additions & 8 deletions deploy/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ services:
##############################################################################


postgres:
extends: imageCommon
image: postgres:latest
env_file:
./postgres.env
ports:
- "5432:5432"

mariadb:
extends: imageCommon
image: mariadb:latest
Expand Down
6 changes: 4 additions & 2 deletions deploy/compile.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/sh
#!/bin/bash
set -e

env
ls /
rm -rf node_modules
npm install
npm run build-backend

if [ "${USER_NAME}" != "root" ]; then
adduser -D -G users -u ${USER_ID} ${USER_NAME}
useradd -G users -u ${USER_ID} ${USER_NAME}
chown -R ${USER_NAME}:${GROUP_ID} outputs/
fi

Expand Down
2 changes: 1 addition & 1 deletion deploy/containers/nginx/Dockerfile.dc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx:1.11
FROM splatform/stratos-nginx-base:dev

RUN mkdir -p /etc/secrets/ && \
openssl req -batch -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/secrets/server.key -out /etc/secrets/server.crt && \
Expand Down
2 changes: 1 addition & 1 deletion deploy/containers/nginx/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx:1.11
FROM splatform/stratos-nginx-base:dev

RUN mkdir -p /etc/secrets/ && \
openssl req -batch -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/secrets/server.key -out /etc/secrets/server.crt && \
Expand Down
2 changes: 1 addition & 1 deletion deploy/containers/nginx/Dockerfile.k8s
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx:1.11
FROM splatform/stratos-nginx-base:dev

RUN mkdir -p /usr/share/doc/suse
COPY ./LICENSE.txt /usr/share/doc/suse/LICENSE.txt
Expand Down
2 changes: 1 addition & 1 deletion deploy/db/Dockerfile.goose.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM splatform/stratos-goose
FROM splatform/stratos-goose-base:dev

WORKDIR /src

Expand Down
6 changes: 2 additions & 4 deletions deploy/db/Dockerfile.k8s.postflight-job
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM golang:1.8-alpine
FROM splatform/stratos-goose-base:dev

RUN apk update && \
apk add postgresql-client mariadb-client git gcc musl-dev
RUN go get bitbucket.org/liamstask/goose/lib/goose
RUN zypper -n in postgresql mariadb-client
RUN go get github.com/go-sql-driver/mysql
COPY goose /usr/local/bin/
COPY deploy/db/dbconf.yml db/dbconf.yml
Expand Down
3 changes: 1 addition & 2 deletions deploy/db/Dockerfile.preflight-job
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM debian:jessie
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y openssl
FROM splatform/stratos-preflight-base:dev
COPY /deploy/db/scripts/run-preflight-job.sh /run-preflight-job.sh
COPY /deploy/tools/generate_cert.sh /generate_cert.sh
CMD ["/run-preflight-job.sh"]
2 changes: 1 addition & 1 deletion deploy/db/scripts/run-postflight-job.k8s.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e

function execStatement {
Expand Down
2 changes: 1 addition & 1 deletion deploy/db/scripts/run-preflight-job.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e

# Step 1 - Set the lock file on the shared volume
Expand Down
10 changes: 5 additions & 5 deletions deploy/docker-compose/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function buildProxy {
-e GROUP_ID=$(id -g) \
--name stratos-proxy-builder \
--volume $(pwd):/go/src/github.com/SUSE/stratos-ui \
${DOCKER_REGISTRY}/${DOCKER_ORG}/stratos-proxy-builder
${DOCKER_REGISTRY}/${DOCKER_ORG}/stratos-proxy-builder:dev
popd > /dev/null 2>&1
popd > /dev/null 2>&1

Expand All @@ -192,7 +192,7 @@ function buildGoose {
# Build the postflight container
echo
echo "-- Build & publish the runtime container image for the postflight job"
preloadImage splatform/stratos-goose:latest
preloadImage splatform/stratos-goose-base:dev
buildAndPublishImage stratos-dc-goose ./db/Dockerfile.goose.dev ${STRATOS_UI_PATH}/deploy
rm -f ${STRATOS_UI_PATH}/goose
}
Expand All @@ -202,7 +202,7 @@ function buildUI {
CURRENT_USER=$
echo
echo "-- Provision the UI"
preloadImage node:6.9.1
preloadImage splatform/stratos-nginx-base:dev
docker run --rm \
${RUN_ARGS} \
-v ${STRATOS_UI_PATH}:/usr/src/app \
Expand All @@ -211,7 +211,7 @@ function buildUI {
-e USER_ID=$(id -u) \
-e GROUP_ID=$(id -g) \
-w /usr/src/app \
node:6.9.1 \
splatform/stratos-nginx-base:dev \
/bin/bash ./deploy/provision.sh

# Copy the artifacts from the above to the nginx container
Expand All @@ -222,7 +222,7 @@ function buildUI {
# Build and push an image based on the nginx container
echo
echo "-- Building/publishing the runtime container image for the Console web server"
preloadImage nginx:1.11
preloadImage splatform/stratos-nginx-base:dev
buildAndPublishImage stratos-dc-console Dockerfile.dc ${STRATOS_UI_PATH}/deploy/containers/nginx
}

Expand Down
10 changes: 3 additions & 7 deletions deploy/kubernetes/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function buildProxy {
-e GROUP_ID=$(id -g) \
--name stratos-proxy-builder \
--volume $(pwd):/go/src/github.com/SUSE/stratos-ui \
${DOCKER_REGISTRY}/${DOCKER_ORG}/stratos-proxy-builder:test
${DOCKER_REGISTRY}/${DOCKER_ORG}/stratos-proxy-builder:dev
popd > /dev/null 2>&1
popd > /dev/null 2>&1

Expand All @@ -201,15 +201,13 @@ function buildPostgres {
echo
echo "-- Build & publish the runtime container image for postgres"
# Pull base image locally and retag
preloadImage postgres:9.4.9
buildAndPublishImage stratos-postgres Dockerfile ${STRATOS_UI_PATH}/deploy/containers/postgres
}

function buildPreflightJob {
# Build the preflight container
echo
echo "-- Build & publish the runtime container image for the preflight job"
preloadImage debian:jessie
buildAndPublishImage stratos-preflight-job ./deploy/db/Dockerfile.preflight-job ${STRATOS_UI_PATH}
}

Expand All @@ -224,7 +222,7 @@ function buildPostflightJob {
--rm \
--name postflight-builder \
--volume $(pwd):/go/bin/ \
${DOCKER_REGISTRY}/${DOCKER_ORG}/stratos-postflight-builder:latest
${DOCKER_REGISTRY}/${DOCKER_ORG}/stratos-postflight-builder:dev
mv goose ${STRATOS_UI_PATH}/
buildAndPublishImage stratos-postflight-job ./deploy/db/Dockerfile.k8s.postflight-job ${STRATOS_UI_PATH}
rm -f ${STRATOS_UI_PATH}/goose
Expand All @@ -235,7 +233,6 @@ function buildUI {
CURRENT_USER=$
echo
echo "-- Provision the UI"
preloadImage node:6.9.1
docker run --rm \
${RUN_ARGS} \
-v ${STRATOS_UI_PATH}:/usr/src/app \
Expand All @@ -244,7 +241,7 @@ function buildUI {
-e USER_ID=$(id -u) \
-e GROUP_ID=$(id -g) \
-w /usr/src/app \
node:6.9.1 \
splatform/stratos-ui-base:dev \
/bin/bash ./deploy/provision.sh

# Copy the artifacts from the above to the nginx container
Expand All @@ -256,7 +253,6 @@ function buildUI {
echo
echo "-- Building/publishing the runtime container image for the Console web server"
# Download and retag image to save bandwidth
preloadImage nginx:1.11
buildAndPublishImage stratos-console Dockerfile.k8s ${STRATOS_UI_PATH}/deploy/containers/nginx
}

Expand Down
6 changes: 3 additions & 3 deletions deploy/provision.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

WORK_DIR=$(pwd)

Expand All @@ -16,12 +16,12 @@ if [ ! -z "${CREATE_USER}" ]; then
fi

npm install
PATH=$PATH:$WORK_DIR/node_modules/.bin
export PATH=$PATH:$WORK_DIR/node_modules/.bin
bower install --allow-root --force
npm run build

if [ ! -z "${CREATE_USER}" ]; then
chown -R ${USER_ID}:${GROUP_ID} node_modules
chown -R ${USER_ID}:${GROUP_ID} bower_components
chown -R ${USER_ID}:${GROUP_ID} dist
fi
fi
5 changes: 5 additions & 0 deletions deploy/stratos-base-images/Dockerfile.stratos-bk-base.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM {{BASE_IMAGE}}
RUN zypper in -y ca-certificates git &&\
mkdir -p /srv

WORKDIR /srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM splatform/stratos-go-base:dev

RUN cd / && wget https://nodejs.org/dist/v6.11.4/node-v6.11.4-linux-x64.tar.xz && \
tar -xf node-v6.11.4-linux-x64.tar.xz
ENV PATH $PATH:/node-v6.11.4-linux-x64/bin
15 changes: 15 additions & 0 deletions deploy/stratos-base-images/Dockerfile.stratos-go-base.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM {{BASE_IMAGE}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to Dockerfile.stratos-go-build-base.tmpl

and update dependencies on this name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated!


RUN zypper -n ref && \
zypper -n up && \
zypper in -y wget which tar git gcc
RUN wget https://storage.googleapis.com/golang/go1.8.4.linux-amd64.tar.gz && \
tar -xzf go1.8.4.linux-amd64.tar.gz -C /usr/local/ && \
mkdir -p /go/bin && \
mkdir -p /go/src
ENV PATH $PATH:/usr/local/go/bin:/go/bin
ENV GOPATH /go
RUN wget https://glide.sh/get && \
chmod +x get && \
./get
WORKDIR /go
2 changes: 2 additions & 0 deletions deploy/stratos-base-images/Dockerfile.stratos-goose-base.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM splatform/stratos-go-base:dev
RUN go get bitbucket.org/liamstask/goose/cmd/goose
5 changes: 5 additions & 0 deletions deploy/stratos-base-images/Dockerfile.stratos-nginx-base.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM {{BASE_IMAGE}}

RUN zypper -n ref && \
zypper -n up && \
zypper in -y nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM {{BASE_IMAGE}}
WORKDIR /
8 changes: 8 additions & 0 deletions deploy/stratos-base-images/Dockerfile.stratos-ui-base.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM {{BASE_IMAGE}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to Dockerfile.stratos-ui-build-base.tmpl

and update dependencies on this name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!


RUN zypper -n ref && \
zypper -n up && \
zypper in -y wget tar git
RUN cd / && wget https://nodejs.org/dist/v6.11.4/node-v6.11.4-linux-x64.tar.xz && \
tar -xf node-v6.11.4-linux-x64.tar.xz
ENV PATH $PATH:/node-v6.11.4-linux-x64/bin
Loading