Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Re-organize scripts in repository to separate dockerfile scripts
Browse files Browse the repository at this point in the history
Move dockerfiles and scripts used in the docker build to ./build folder
to make build structure clearer.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
  • Loading branch information
amisevsk committed Sep 10, 2019
1 parent bc6cafa commit a608827
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ VERSION=$(head -n 1 VERSION)
case $VERSION in
*SNAPSHOT)
echo "Snapshot version (${VERSION}) specified in $(find . -name VERSION): building nightly plugin registry."
docker build -t quay.io/eclipse/che-devfile-registry:nightly .
docker build -t "quay.io/eclipse/che-devfile-registry:nightly" -f ./build/dockerfiles/Dockerfile .
;;
*)
echo "Release version specified in $(find . -name VERSION): Building plugin registry for release ${VERSION}."
docker build -t "quay.io/eclipse/che-devfile-registry:${VERSION}" . --build-arg "PATCHED_IMAGES_TAG=${VERSION}"
docker build -t "quay.io/eclipse/che-devfile-registry:${VERSION}" -f ./build/dockerfiles/Dockerfile . --build-arg "PATCHED_IMAGES_TAG=${VERSION}"
;;
esac
5 changes: 3 additions & 2 deletions Dockerfile → build/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ARG PATCHED_IMAGES_REG="quay.io"
ARG PATCHED_IMAGES_ORG="eclipse"
ARG PATCHED_IMAGES_TAG="nightly"

COPY .htaccess README.md *.sh ./arbitrary-users-patch/base_images /build/
COPY ./build/scripts ./arbitrary-users-patch/base_images /build/
COPY /devfiles /build/devfiles
WORKDIR /build/
RUN TAG=${PATCHED_IMAGES_TAG} \
Expand All @@ -27,6 +27,7 @@ RUN ./index.sh > /build/devfiles/index.json

FROM registry.centos.org/centos/httpd-24-centos7
RUN mkdir /var/www/html/devfiles
COPY --from=builder /build/ /var/www/html/
COPY .htaccess README.md /var/www/html/
COPY --from=builder /build/devfiles /var/www/html/devfiles
USER 0
RUN chmod -R g+rwX /var/www/html/devfiles
7 changes: 5 additions & 2 deletions Dockerfile.rhel → build/dockerfiles/Dockerfile.rhel
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
FROM alpine:3.10 AS builder
RUN apk add --no-cache py-pip jq bash && pip install yq

# Registry, organization, and tag to use for base images in dockerfiles. Devfiles
# will be rewritten during build to use these values for base images.
ARG PATCHED_IMAGES_REG="quay.io"
ARG PATCHED_IMAGES_ORG="eclipse"
ARG PATCHED_IMAGES_TAG="nightly"

COPY .htaccess README.md *.sh ./arbitrary-users-patch/base_images /build/
COPY ./build/scripts ./arbitrary-users-patch/base_images /build/
COPY /devfiles /build/devfiles
WORKDIR /build/
RUN TAG=${PATCHED_IMAGES_TAG} \
Expand All @@ -37,7 +39,8 @@ RUN chmod a+rwX /etc/httpd/conf
RUN chmod a+rwX /run/httpd

RUN mkdir /var/www/html/devfiles
COPY --from=builder /build/ /var/www/html/
COPY .htaccess README.md /var/www/html/
COPY --from=builder /build/devfiles /var/www/html/devfiles
USER 0
RUN chmod -R g+rwX /var/www/html/devfiles

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions cico_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ function setup_environment() {
export GIT_COMMIT_TAG

if [ "$TARGET" == "rhel" ]; then
export DOCKERFILE="Dockerfile.rhel"
export DOCKERFILE_PATH="./build/dockerfiles/Dockerfile.rhel"
export ORGANIZATION="openshiftio"
export IMAGE="rhel-che-devfile-registry"
else
export DOCKERFILE="Dockerfile"
export DOCKERFILE_PATH="./build/dockerfiles/Dockerfile"
export ORGANIZATION="eclipse"
export IMAGE="che-devfile-registry"
# For pushing to quay.io 'eclipse' organization we need to use different credentials
Expand All @@ -99,7 +99,7 @@ function setup_environment() {
# Build, tag, and push devfile registry, tagged with ${TAG} and ${GIT_COMMIT_TAG}
function build_and_push() {
# Let's build and push image to 'quay.io' using git commit hash as tag first
docker build -t ${IMAGE} -f ${DOCKERFILE} .
docker build -t ${IMAGE} -f ${DOCKERFILE_PATH} .
tag_push "${REGISTRY}/${ORGANIZATION}/${IMAGE}:${GIT_COMMIT_TAG}"
echo "CICO: '${GIT_COMMIT_TAG}' version of images pushed to '${REGISTRY}/${ORGANIZATION}' organization"

Expand All @@ -115,7 +115,7 @@ function build_and_push() {
# arbitrary user patch
function build_and_push_release() {
echo "CICO: building release '${TAG}' version of devfile registry"
docker build -t ${IMAGE} -f ${DOCKERFILE} . \
docker build -t ${IMAGE} -f ${DOCKERFILE_PATH} . \
--build-arg PATCHED_IMAGES_REG=${REGISTRY} \
--build-arg PATCHED_IMAGES_ORG=${ORGANIZATION} \
--build-arg PATCHED_IMAGES_TAG=${TAG}
Expand Down

0 comments on commit a608827

Please sign in to comment.