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

ci: configure konflux build #539

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions .tekton/discovery-ui-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ spec:
value: Containerfile
- name: path-context
value: .
- name: hermetic
value: "true"
- name: build-source-image
value: "true"
- name: prefetch-input
value: '{"type": "npm", "path": "."}'
- name: build-args-file
value: ".tekton/downstream-build-arguments.conf"
pipelineSpec:
description: |
This pipeline is ideal for building container images from a Containerfile while reducing network traffic.
Expand Down
8 changes: 8 additions & 0 deletions .tekton/discovery-ui-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ spec:
value: Containerfile
- name: path-context
value: .
- name: hermetic
value: "true"
- name: build-source-image
value: "true"
- name: prefetch-input
value: '{"type": "npm", "path": "."}'
- name: build-args-file
value: ".tekton/downstream-build-arguments.conf"
pipelineSpec:
description: |
This pipeline is ideal for building container images from a Containerfile while reducing network traffic.
Expand Down
6 changes: 6 additions & 0 deletions .tekton/downstream-build-arguments.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
K8S_DESCRIPTION=Discovery UI
K8S_DISPLAY_NAME=discovery-ui
K8S_NAME=discovery/discovery-ui-rhel9
OCP_TAGS=discovery
QUIPUCORDS_BRANDED=true
REDHAT_COMPONENT=discovery-ui-container
36 changes: 32 additions & 4 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,46 @@
FROM registry.access.redhat.com/ubi9/nodejs-18 as npm_builder
ARG QUIPUCORDS_BRANDED="false"
# Become root before installing anything
USER root
RUN dnf update -y && dnf clean all

# install dependencies in a separate layer to save dev time
WORKDIR /app
COPY package.json package-lock.json .
RUN npm install --omit=dev
RUN npm ci \
--no-audit \
--legacy-peer-deps \
--omit=dev

COPY . .
RUN npm run build
RUN export UI_BRAND=${QUIPUCORDS_BRANDED}; npm run build

FROM registry.access.redhat.com/ubi9/nginx-122
ARG K8S_DESCRIPTION="Quipucords UI"
ARG K8S_DISPLAY_NAME="quipucords-ui"
ARG K8S_NAME="quipucords/quipucords-ui"
ARG OCP_TAGS="quipucords"
ARG REDHAT_COMPONENT="quipucords-ui-container"

# original NGINX user; update if the number ever change
# https://github.com/sclorg/nginx-container/blob/e7d8db9bc5299a4c4e254f8a82e917c7c136468b/1.22/Dockerfile.rhel9#L84
ENV NGINX_USER=1001
# temporarily switch to root user
USER root
# konflux requires licenses in this folder
RUN mkdir /licenses
COPY --from=npm_builder /app/LICENSE /licenses/LICENSE
COPY --from=npm_builder /app/build /opt/app-root/src
COPY deploy/nginx.conf /etc/nginx/nginx.conf.template
COPY deploy/entrypoint.sh /opt/app-root/.
# set ownership to nginx user and change back to it
RUN chown ${NGINX_USER} -R /licenses /opt/app-root/
USER ${NGINX_USER}

CMD ["/bin/bash", "/opt/app-root/entrypoint.sh"]

LABEL com.redhat.component=${REDHAT_COMPONENT} \
description=${K8S_DESCRIPTION} \
io.k8s.description=${K8S_DESCRIPTION} \
io.k8s.display-name=${K8S_DISPLAY_NAME} \
io.openshift.tags=${OCP_TAGS} \
name=${K8S_NAME} \
summary=${K8S_DESCRIPTION}
Loading