Skip to content

Commit

Permalink
Merge branch 'main' into bob/2663-query-flow-redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
fzhao99 committed Oct 15, 2024
2 parents 5893873 + 9f49050 commit ef8a654
Show file tree
Hide file tree
Showing 30 changed files with 4,154 additions and 5,753 deletions.
10 changes: 9 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
# PULL REQUEST

## Summary

What changes are being proposed?

## Related Issue

Fixes #

## Acceptance Criteria

Please copy the acceptance criteria from your ticket and paste it here for your reviewer(s)

For frontend PR’s - include a description (including anything that’s out of scope) for what you want the designers to review

- ex: _“Check out the whitespace on the page, as well as the dropdowns in the form. Here is the corresponding Figma link. You can ignore everything else. Also, the button at the bottom doesn’t work now”_

## Additional Information

Anything else the review team should know?

## Checklist

- [ ] If this code affects the other scrum team, have they been notified? (In Slack, as reviewers, etc.)

[//]: # (PR title: Remember to name your PR descriptively!)
[//]: # "PR title: Remember to name your PR descriptively!"
24 changes: 0 additions & 24 deletions .github/workflows/container-tefca-viewer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,6 @@ jobs:
working-directory: ./containers/${{env.CONTAINER}} # Navigate to your Node.js app directory
run: npm test

build-container:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Check Out Changes
uses: actions/checkout@v4

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

- name: Build ${{ env.CONTAINER }} Container
uses: docker/build-push-action@v3
with:
context: .
file: ./containers/${{ env.CONTAINER }}/Dockerfile
push: false
cache-from: type=gha
cache-to: type=gha,mode=max

playwright-tests:
timeout-minutes: 10
runs-on: ubuntu-latest
Expand Down
51 changes: 0 additions & 51 deletions .github/workflows/package-shared-resources.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
rev: v0.6.9
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: pretty-format-json
args: [--autofix, --no-sort-keys]
- repo: https://github.com/pre-commit/mirrors-eslint
rev: "v9.9.0"
rev: "v9.12.0"
hooks:
- id: eslint
name: ESLint for ECR Viewer
Expand Down
10 changes: 0 additions & 10 deletions Makefile

This file was deleted.

55 changes: 16 additions & 39 deletions containers/tefca-viewer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
FROM node:18-alpine AS base

FROM base AS builder
# Install necessary packages for building
FROM base AS installer

RUN apk update
RUN apk add --no-cache libc6-compat
RUN apk add --no-cache bash curl

# Set working directory
WORKDIR /app
RUN npm i -g turbo
COPY . .
ENV TURBO_TELEMETRY_DISABLED=1
RUN turbo prune tefca-viewer --docker

# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer
RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /app

ENV FLYWAY_VERSION=10.19.0

# Add bash to enable running Flyway
RUN apk add --no-cache bash curl

# Install Flyway and remove JRE directory to force flyway to use the openjdk11 version in the runner
ENV FLYWAY_VERSION=10.19.0
RUN curl -L https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY_VERSION}/flyway-commandline-${FLYWAY_VERSION}-linux-x64.tar.gz -o flyway.tar.gz \
&& tar -zxvf flyway.tar.gz \
&& mv flyway-${FLYWAY_VERSION} /flyway \
Expand All @@ -32,19 +19,10 @@ RUN curl -L https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLY
&& rm -rf /flyway/jre \
&& chmod +x /flyway/flyway

# First install the dependencies
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/package-lock.json ./package-lock.json
RUN npm i

# Build the project
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
ENV NEXT_TELEMETRY_DISABLED=1
ENV TURBO_TELEMETRY_DISABLED=1

RUN npx turbo build --filter=tefca-viewer...
RUN npm ci
RUN npm run build

# Final stage for running the app
FROM base AS runner
Expand All @@ -64,26 +42,25 @@ RUN adduser --system --uid 1001 nextjs
USER nextjs

# Set hostname to localhost
ENV HOSTNAME "0.0.0.0"
ENV HOSTNAME="0.0.0.0"

# Copy necessary app files
COPY --from=installer /app/containers/tefca-viewer/next.config.js .
COPY --from=installer /app/containers/tefca-viewer/package.json .
COPY --from=installer /app/containers/tefca-viewer/flyway/conf/flyway.conf /flyway/conf/flyway.conf
COPY --from=installer /app/containers/tefca-viewer/flyway/sql /flyway/sql
COPY --from=installer /app/next.config.js .
COPY --from=installer /app/package.json .
COPY --from=installer /app/flyway/conf/flyway.conf ../flyway/conf/flyway.conf
COPY --from=installer /app/flyway/sql ../flyway/sql

# Automatically leverage output traces to reduce image size
COPY --from=installer --chown=nextjs:nodejs /app/containers/tefca-viewer/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/containers/tefca-viewer/.next/static ./containers/tefca-viewer/.next/static
COPY --from=installer --chown=nextjs:nodejs /app/containers/tefca-viewer/public ./containers/tefca-viewer/public

COPY --from=installer --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=installer --chown=nextjs:nodejs /app/public ./public
RUN ls -R
# Set environment variables for Flyway and Node.js telemetry
ENV TURBO_TELEMETRY_DISABLED=1
ENV NEXT_TELEMETRY_DISABLED=1

# Set JAVA_HOME to the OpenJDK version installed by apk for Flyway
ENV JAVA_HOME=/usr/lib/jvm/default-jvm
# Add the OpenJDK to the PATH so the java command is available for Flways
ENV PATH=$JAVA_HOME/bin:$PATH

CMD ["sh", "-c","flyway -configFiles=/flyway/conf/flyway.conf -schemas=public -connectRetries=60 migrate && echo done with flyway && node containers/tefca-viewer/server.js"]
CMD ["sh", "-c","flyway -configFiles=../flyway/conf/flyway.conf -schemas=public -connectRetries=60 migrate && echo done with flyway && node server.js"]
1 change: 1 addition & 0 deletions containers/tefca-viewer/docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
flyway:
image: flyway/flyway:10.16-alpine
command: -configFiles=/flyway/conf/flyway.conf -schemas=public -connectRetries=60 migrate
platform: linux/amd64
volumes:
- ./flyway/sql:/flyway/sql
- ./flyway/conf/flyway.conf:/flyway/conf/flyway.conf
Expand Down
4 changes: 2 additions & 2 deletions containers/tefca-viewer/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ services:
tefca-viewer:
platform: linux/amd64
build:
context: ../../
dockerfile: ./containers/tefca-viewer/Dockerfile
context: .
dockerfile: Dockerfile
tty: true
ports:
- "3000:3000"
Expand Down
5 changes: 4 additions & 1 deletion containers/tefca-viewer/e2e/query_workflow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ test.describe("querying with the TryTEFCA viewer", () => {
await page.getByLabel("Medical Record Number").fill("18091");
await page.getByLabel("Phone Number").fill("5555555555");
await page.getByRole("button", { name: "Search for patient" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });

await page.getByRole("link", { name: "Select patient" }).click();
await expect(
Expand Down Expand Up @@ -143,6 +144,7 @@ test.describe("querying with the TryTEFCA viewer", () => {

// Among verification, make sure phone number is right
await page.getByRole("button", { name: "Search for patient" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });
await expect(
page.getByRole("heading", { name: "Patient Record" }),
).toBeVisible();
Expand Down Expand Up @@ -174,8 +176,9 @@ test.describe("querying with the TryTEFCA viewer", () => {
await page.getByRole("button", { name: "Go to the demo" }).click();
await page.getByLabel("Query", { exact: true }).selectOption("chlamydia");
await page.getByRole("button", { name: "Fill fields" }).click();
// await page.getByLabel("Phone Number").fill("");
await page.getByRole("button", { name: "Search for patient" }).click();
await expect(page.getByText("Loading")).toHaveCount(0, { timeout: 10000 });

await expect(
page.getByRole("heading", { name: "Patient Record" }),
).toBeVisible();
Expand Down
Loading

0 comments on commit ef8a654

Please sign in to comment.