Skip to content

Commit

Permalink
Build UI direct in action, simplify UI Dockerfile, fix API release ar…
Browse files Browse the repository at this point in the history
…gs (#864)

Also correct reference to environments repo

Signed-off-by: Michael Edgar <[email protected]>
  • Loading branch information
MikeEdgar authored Jul 3, 2024
1 parent c3fea5b commit 010c6fd
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/gitops-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"platform": "github",
"repositories": ["streamshub/deployment-environments"]
"repositories": [ "eyefloaters/deployment-environments" ]
}
12 changes: 12 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,23 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build UI
working-directory: ui
run: |
npm ci --omit=dev
export BACKEND_URL=http://example
export CONSOLE_METRICS_PROMETHEUS_URL=http://example
export NEXTAUTH_SECRET=examplesecret
export LOG_LEVEL=info
export CONSOLE_MODE=read-only
npm run build
- name: Build UI Image
uses: docker/build-push-action@v6
with:
context: ui/
platforms: linux/amd64,linux/arm64
provenance: false
push: false
tags: |
streamshub/console-ui:latest
14 changes: 13 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
export QUARKUS_CONTAINER_IMAGE_ADDITIONAL_TAGS=latest
export GIT_REVISION=$(git rev-parse --short release)
# Build and push the release images using the commit tagged in `release:prepare`
mvn -B -P docker release:perform -Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64
mvn -B -P docker release:perform '-Drelease.arguments=-Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64'
- name: Login to Quay
uses: docker/login-action@v3
Expand All @@ -64,11 +64,23 @@ jobs:
username: "${{ secrets.IMAGE_REPO_USERNAME }}"
password: "${{ secrets.IMAGE_REPO_PASSWORD }}"

- name: Build UI
working-directory: ui
run: |
npm ci --omit=dev
export BACKEND_URL=http://example
export CONSOLE_METRICS_PROMETHEUS_URL=http://example
export NEXTAUTH_SECRET=examplesecret
export LOG_LEVEL=info
export CONSOLE_MODE=read-only
npm run build
- name: Build and Push UI Image
uses: docker/build-push-action@v6
with:
context: ui/
platforms: linux/amd64,linux/arm64
provenance: false
push: true
tags: |
${{ secrets.IMAGE_REPO_HOSTNAME }}/${{ secrets.IMAGE_REPO_NAMESPACE }}/console-ui:${{steps.metadata.outputs.current-version}}
Expand Down
1 change: 0 additions & 1 deletion ui/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ Dockerfile
node_modules
npm-debug.log
CONTRIBUTING.md
.next
.git
.env.*
45 changes: 8 additions & 37 deletions ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,13 @@
ARG log_level=info
ARG console_mode=read-only

FROM registry.access.redhat.com/ubi9/nodejs-18 AS deps
USER 0
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci --omit=dev

FROM registry.access.redhat.com/ubi9/nodejs-18 AS builder
USER 0
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ARG backend_url=http://example
ARG console_metrics_prometheus_url=http://example
ARG nextauth_secret=examplesecret
ARG log_level
ARG console_mode

ENV BACKEND_URL=$backend_url
ENV CONSOLE_METRICS_PROMETHEUS_URL=$console_metrics_prometheus_url
ENV NEXTAUTH_SECRET=$nextauth_secret
ENV LOG_LEVEL=$log_level
ENV CONSOLE_MODE=$console_mode

RUN npm run build

FROM registry.access.redhat.com/ubi9/nodejs-18-minimal AS runner
FROM registry.access.redhat.com/ubi9/nodejs-18-minimal
USER 0
WORKDIR /app

COPY --from=builder /app/public ./public
COPY --from=builder --chown=1001:1001 /app/.next/standalone ./
COPY --from=builder --chown=1001:1001 /app/.next/static ./.next/static
COPY public ./public
COPY --chown=1001:1001 .next/standalone ./
COPY --chown=1001:1001 .next/static ./.next/static

ARG log_level
ARG console_mode
ARG log_level=info
ARG console_mode=read-only

# Ensure set to some default for runtime
ENV LOG_LEVEL=$log_level
Expand All @@ -46,7 +17,7 @@ USER 1001

EXPOSE 3000

ENV NODE_ENV production
ENV PORT 3000
ENV NODE_ENV=production
ENV PORT=3000

CMD ["node", "server.js"]

0 comments on commit 010c6fd

Please sign in to comment.