Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
Build on RHEL (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmelis authored and aslakknutsen committed Apr 27, 2018
1 parent f89caa7 commit f2791a5
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 13 deletions.
8 changes: 7 additions & 1 deletion .make/docker.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
DOCKER_IMAGE_CORE := $(PROJECT_NAME)
DOCKER_IMAGE_DEPLOY := $(PROJECT_NAME)-deploy

ifeq ($(TARGET),rhel)
DOCKERFILE_DEPLOY := Dockerfile.deploy.rhel
else
DOCKERFILE_DEPLOY := Dockerfile.deploy
endif

# If running in Jenkins we don't allow for interactively running the container
ifneq ($(BUILD_TAG),)
DOCKER_RUN_INTERACTIVE_SWITCH :=
Expand Down Expand Up @@ -30,7 +36,7 @@ docker-image-builder:
.PHONY: docker-image-deploy
## Creates a runnable image using the artifacts from the bin directory.
docker-image-deploy:
docker build -t $(DOCKER_IMAGE_DEPLOY) -f $(CUR_DIR)/Dockerfile.deploy $(CUR_DIR)
docker build -t $(DOCKER_IMAGE_DEPLOY) -f $(CUR_DIR)/$(DOCKERFILE_DEPLOY) $(CUR_DIR)

.PHONY: docker-publish-deploy
## Tags the runnable image and pushes it to the docker hub.
Expand Down
22 changes: 22 additions & 0 deletions Dockerfile.deploy.rhel
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM prod.registry.devshift.net/osio-prod/base/pcp:latest
LABEL maintainer "Devtools <[email protected]>"
LABEL author "Devtools <[email protected]>"
ENV LANG=en_US.utf8
ENV INSTALL_PREFIX=/usr/local/f8

# Create a non-root user and a group with the same name: "f8"
ENV USER_NAME=f8
RUN useradd --no-create-home -s /bin/bash ${USER_NAME}

COPY bin/fabric8-notification ${INSTALL_PREFIX}/bin/fabric8-notification

COPY ./notification+pmcd.sh /notification+pmcd.sh
EXPOSE 44321

# From here onwards, any RUN, CMD, or ENTRYPOINT will be run under the following user
USER ${USER_NAME}

WORKDIR ${INSTALL_PREFIX}
ENTRYPOINT [ "/notification+pmcd.sh" ]

EXPOSE 8080
26 changes: 16 additions & 10 deletions cico_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function load_jenkins_vars() {

function install_deps() {
# We need to disable selinux for now, XXX
/usr/sbin/setenforce 0
/usr/sbin/setenforce 0 || :

# Get all the deps in
yum -y install \
Expand Down Expand Up @@ -102,26 +102,32 @@ function run_tests_with_coverage() {
}

function tag_push() {
TARGET=$1
docker tag fabric8-notification-deploy $TARGET
docker push $TARGET
local tag=$1

docker tag fabric8-notification-deploy $tag
docker push $tag
}

function deploy() {
if [ -n "${DEVSHIFT_USERNAME}" -a -n "${DEVSHIFT_PASSWORD}" ]; then
docker login -u ${DEVSHIFT_USERNAME} -p ${DEVSHIFT_PASSWORD} ${REGISTRY}
else
echo "Could not login, missing credentials for the registry"
fi

# Let's deploy
make docker-image-deploy

TAG=$(echo $GIT_COMMIT | cut -c1-${DEVSHIFT_TAG_LEN})
REGISTRY="push.registry.devshift.net"

if [ -n "${DEVSHIFT_USERNAME}" -a -n "${DEVSHIFT_PASSWORD}" ]; then
docker login -u ${DEVSHIFT_USERNAME} -p ${DEVSHIFT_PASSWORD} ${REGISTRY}
if [ "$TARGET" = "rhel" ]; then
tag_push ${REGISTRY}/osio-prod/fabric8-services/fabric8-notification:$TAG
tag_push ${REGISTRY}/osio-prod/fabric8-services/fabric8-notification:latest
else
echo "Could not login, missing credentials for the registry"
tag_push ${REGISTRY}/fabric8-services/fabric8-notification:$TAG
tag_push ${REGISTRY}/fabric8-services/fabric8-notification:latest
fi

tag_push ${REGISTRY}/fabric8-services/fabric8-notification:$TAG
tag_push ${REGISTRY}/fabric8-services/fabric8-notification:latest
echo 'CICO: Image pushed, ready to update deployed app'
}

Expand Down
6 changes: 4 additions & 2 deletions openshift/OpenShiftTemplate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ objects:
secretKeyRef:
name: f8notification
key: service.account.secret
image: registry.devshift.net/fabric8-services/fabric8-notification:${IMAGE_TAG}
image: ${IMAGE}:${IMAGE_TAG}
imagePullPolicy: Always
name: f8notification
ports:
Expand Down Expand Up @@ -95,7 +95,7 @@ objects:
timeoutSeconds: 1
resources:
limits:
memory: 1Gi
memory: 1Gi
triggers:
- type: ConfigChange
- apiVersion: v1
Expand All @@ -110,5 +110,7 @@ objects:
selector:
deploymentconfig: f8notification
parameters:
- name: IMAGE
value: registry.devshift.net/fabric8-services/fabric8-notification
- name: IMAGE_TAG
value: latest

0 comments on commit f2791a5

Please sign in to comment.