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

Verify build fix with prisma field encryption inclusion #65

Merged
merged 14 commits into from
Sep 18, 2024
Merged
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
4 changes: 2 additions & 2 deletions .env.production.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ SHLP_POSTGRES_DB=
SHLP_POSTGRES_USERNAME=
SHLP_POSTGRES_PASSWORD=
POSTGRES_PRISMA_URL=postgresql://${SHLP_POSTGRES_USERNAME}:${SHLP_POSTGRES_PASSWORD}@${SHLP_POSTGRES_HOST}:5432/${SHLP_POSTGRES_DB}
PRISMA_FIELD_ENCRYPTION_KEY=
PRISMA_FIELD_ENCRYPTION_HASH_SALT=
PRISMA_FIELD_ENCRYPTION_KEY=k1.aesgcm256.Wmy6koJaJpjB0H25qBccLfQ84AvpmCjexanqCHJ5Hr0=
PRISMA_FIELD_ENCRYPTION_HASH_SALT=1a4671c31ff22834a56d4f3741aeac8cc8662a11c73802083ea5a118e5ee600e
BMartinos marked this conversation as resolved.
Show resolved Hide resolved
99 changes: 0 additions & 99 deletions .github/workflows/run-tests.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
name: Build and Push Smart Health Links Portal Image
name: Test - Build - Push

on:
workflow_run:
workflows: ['Tests with Coverage Check']
types: [completed]
push:
branches:
- 'main'
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Run Jest Tests
run: yarn test --collectCoverage=false

build-and-push:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -21,21 +38,21 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push tag
- name: Test Docker build
if: ${{ github.ref_name != 'main' }}
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
platforms: linux/amd64
push: false # dont push image - Used to confirm build success on branches
file: docker/production/Dockerfile
tags: jembi/smart-health-links-portal:${{ github.ref_name }}

- name: Login to DockerHub
if: ${{ github.ref_name == 'main' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push latest
if: ${{ github.ref_name == 'main' }}
uses: docker/build-push-action@v5
Expand Down
9 changes: 4 additions & 5 deletions docker/production/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM node:20-alpine AS base
# 1. Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
RUN apk add --update --no-cache libc6-compat python3 make g++ && rm -rf /var/cache/apk/*

WORKDIR /app

Expand All @@ -20,7 +20,7 @@ COPY --from=deps /app/node_modules ./node_modules
COPY . .
# This will do the trick, use the corresponding env file for each environment.
COPY .env.production.example .env.production
RUN npm run build
RUN npm run build --turbo

# 3. Production image, copy all the files and run next
FROM base AS runner
Expand All @@ -38,12 +38,11 @@ COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static


USER nextjs

EXPOSE 3000

ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"

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