Skip to content

Commit

Permalink
fixing backend url
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaland committed Oct 15, 2024
1 parent a0bcebc commit 3c5f03b
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 26 deletions.
29 changes: 7 additions & 22 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,14 @@ jobs:
- name: Install dependencies
run: |
npm install
- name: Build Application
run: |
npm run build
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
retention-days: 1

# TODO: Figure out a cleaner way to do this
- name: 'Tar files'
run: tar -cvf node_modules.tar node_modules
run: tar -cvf code.tar .
- name: Archive node modules
uses: actions/upload-artifact@v4
with:
name: node_modules
path: node_modules.tar
name: code
path: code.tar
include-hidden-files: true
retention-days: 1
build-image:
Expand All @@ -93,21 +84,15 @@ jobs:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_BASE_REGISTRY }}

- name: Download production artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Download node modules
uses: actions/download-artifact@v4
with:
name: node_modules
path: node_modules.tar
name: code
path: .

- name: 'Untar files'
run: tar -xvf node_modules.tar
run: tar -xvf code.tar

- name: Build and push
uses: docker/build-push-action@v2
Expand Down
119 changes: 119 additions & 0 deletions .github/workflows/ci.yaml-old
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: CI
on:
pull_request:
push:
branches:
- main
- release*
tags:
- v*

env:
IMAGE_REGISTRY: quay.io/redhat-saia/chatbot-ui-patternfly
IMAGE_BASE_REGISTRY: quay.io

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install dependencies
run: npm install
- name: Run eslint
run: npm run lint
# TODO: Test currently failing
# test:
# name: Test
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Setup Node.js
# uses: actions/setup-node@v3
# with:
# node-version: lts/*
# - name: Install dependencies
# run: npm install
# - name: Run tests
# run: npm run test
build:
# needs: test, lint //TODO: Add this back later, removing for speed
name: Build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://npm.pkg.github.com'
- name: Install dependencies
run: |
npm install
- name: Build Application
run: |
npm run build
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
retention-days: 1

- name: 'Tar files'
run: tar -cvf node_modules.tar node_modules
- name: Archive node modules
uses: actions/upload-artifact@v4
with:
name: node_modules
path: node_modules.tar
include-hidden-files: true
retention-days: 1
build-image:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Registry
uses: docker/login-action@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_BASE_REGISTRY }}

- name: Download production artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Download node modules
uses: actions/download-artifact@v4
with:
name: node_modules
path: .

- name: 'Untar files'
run: tar -xvf node_modules.tar

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Containerfile
push: true
tags: ${{ env.IMAGE_REGISTRY }}:${{ github.ref_name }}, ${{ env.IMAGE_REGISTRY }}:latest
ulimit: nofile=4096
8 changes: 4 additions & 4 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ FROM registry.access.redhat.com/ubi9/nodejs-20-minimal AS production

WORKDIR app_home

COPY node_modules ./node_modules
COPY dist ./dist
COPY package*.json ./
COPY . .

# Create .cache directories
USER root

RUN npm install

# Expose the port the app will run on
USER 1001

EXPOSE 3000

# Start the application
CMD ["npm", "start"]
CMD /bin/sh -c "npm run build && npm start"

0 comments on commit 3c5f03b

Please sign in to comment.