Skip to content

Commit

Permalink
Update git build permissions.
Browse files Browse the repository at this point in the history
  • Loading branch information
brysonjbest committed Sep 24, 2024
1 parent 38f7c42 commit ae667dd
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 152 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,33 @@ env:
jobs:
build_image:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Clean npm cache
run: npm cache clean --force

- name: Install dependencies and update lock file if necessary
run: |
if [ -f package-lock.json ]; then
npm ci || npm install
else
npm install
fi
- name: Login to Container Registry
uses: docker/login-action@v3
with:
Expand Down Expand Up @@ -47,13 +70,11 @@ jobs:
deploy:
needs: build_image
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Authenticate and set context for OpenShift
uses: redhat-actions/oc-login@v1

with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
namespace: ${{ github.ref == 'refs/heads/main' && secrets.OPENSHIFT_PROD_NAMESPACE || secrets.OPENSHIFT_DEV_NAMESPACE }}
Expand All @@ -62,4 +83,4 @@ jobs:

- name: Run Helm
run: |
helm upgrade --install brms-frontend ./helm --set image.tag=${{ needs.build_image.outputs.image_tag }}
helm upgrade --install brms-frontend ./helm --set image.tag=${{ needs.build_image.outputs.image_tag }}
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ RUN npm ci --no-strict-ssl --no-shrinkwrap --verbose || npm install --prefer-onl
# Copy the application code
COPY . ./

# Create a non-root user and switch to it
RUN useradd -m myuser
USER myuser

# Make sure the user owns the application files
RUN chown -R myuser:myuser /opt/app-root/src

# Build the Next.js application
RUN npm run build

Expand Down
Loading

0 comments on commit ae667dd

Please sign in to comment.