diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..04b3392 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,29 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +Thank you for taking the time to contribute an issue! + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..49bd3cd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem in the current program to new available techology or software? Please describe and add links/citations if appropriate.** +A clear and concise description of what the problem is or what the advance you would like us to incorporate is. Ex. when triaging structural variantS, I would like to [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/other-issue.md b/.github/ISSUE_TEMPLATE/other-issue.md new file mode 100644 index 0000000..b28a3dc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other-issue.md @@ -0,0 +1,10 @@ +--- +name: Other issue +about: Describe your issue, request or question here +title: '' +labels: '' +assignees: '' + +--- + +Try to be as clear and precise as possible, adding sufficient detail and context. diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml new file mode 100644 index 0000000..7f149b1 --- /dev/null +++ b/.github/workflows/build_and_publish.yml @@ -0,0 +1,25 @@ +name: Publish to Docker Hub + +on: + release: + types: + - created + +jobs: + docker-image-CI: + name: Docker Image CI + runs-on: ubuntu-latest + steps: + + - name: Check out git repository + uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Publish main image (Dockerfile) to Registry + uses: elgohr/Publish-Docker-Github-Action@v5 + with: + name: clinicalgenomics/phenopacket-api + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + tags: "latest,${{ github.event.release.tag_name }}" diff --git a/.github/workflows/keep_a_changelog.yml b/.github/workflows/keep_a_changelog.yml new file mode 100644 index 0000000..e13f937 --- /dev/null +++ b/.github/workflows/keep_a_changelog.yml @@ -0,0 +1,15 @@ +name: "Changelog Reminder" +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled] + +jobs: + # Enforces the update of a changelog file on every pull request + changelog: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dangoslen/changelog-enforcer@v3 + with: + changeLogPath: 'CHANGELOG.md' + skipLabels: 'Skip-Changelog' diff --git a/.github/workflows/push_build_latest_docker.yml b/.github/workflows/push_build_latest_docker.yml new file mode 100644 index 0000000..435deee --- /dev/null +++ b/.github/workflows/push_build_latest_docker.yml @@ -0,0 +1,26 @@ +name: Publish to Docker Hub + +on: + pull_request: + branches: + - main + +jobs: + docker-image-CI: + name: Docker Image CI + runs-on: ubuntu-latest + steps: + + - name: Check out git repository + uses: actions/checkout@v4 + with: + submodules: 'recursive' + + + - name: Publish main image (Dockerfile) to Registry + uses: elgohr/Publish-Docker-Github-Action@v5 + with: + name: clinicalgenomics/phenopacket-api-stage + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + tags: "latest, ${{steps.branch-name.outputs.current_branch}}" diff --git a/.github/workflows/woke.yml b/.github/workflows/woke.yml new file mode 100644 index 0000000..146b506 --- /dev/null +++ b/.github/workflows/woke.yml @@ -0,0 +1,15 @@ +name: woke +on: + - pull_request +jobs: + woke: + name: Non-inclusive language check with woke + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: woke + uses: get-woke/woke-action@v0 + with: + fail-on-error: false diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ba945e4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +## [unreleased] +### Changed +- Allow configuring multiple trusted CORS origins +- CG production Docker automation +- CG stage Docker automation +- More recent docker base image + +## Legacy version history + +## 1.1.0 +- Generate password for customformdata +- Backend status +## 1.0.0 +- Initial release diff --git a/Dockerfile b/Dockerfile index bea75f4..8496dc7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16-alpine as base +FROM node:22-alpine as base # Create app directory WORKDIR /usr/src/app COPY package*.json ./ @@ -11,14 +11,18 @@ FROM base as build-stage RUN npm run build # # stage 2 - copy from buildstage to "prod image" -FROM node:16-alpine as production-stage +FROM node:22-alpine as production-stage WORKDIR /app RUN chown node:node . USER node COPY package*.json ./ COPY tsconfig.json ./ +COPY apischema.json ./ + RUN npm ci --only=production COPY --from=build-stage /usr/src/app/dist ./dist +COPY ./phenopacket-schema ./phenopacket-schema + EXPOSE 3000 -CMD ["node", "/app/dist/index.js"] \ No newline at end of file +CMD ["node", "/app/dist/index.js"] diff --git a/README.md b/README.md index 3850381..118e5a3 100644 --- a/README.md +++ b/README.md @@ -43,14 +43,3 @@ Express + Typescript + MongoDB stack for storing Phenopackets. `npm install -g protobuf2swagger` `protobuf2swagger` - -## Version history - -### 1.0.0 - -- Initial release - -### 1.1.0 - -- Generate password for customformdata -- Backend status diff --git a/src/index.ts b/src/index.ts index 589e7f9..ecbe419 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,7 +14,7 @@ app.use(express.json({ limit: "100mb" })); app.use(express.urlencoded({ extended: true })); app.use( cors({ - origin: process.env.ALLOWED_ORIGIN, + origin: process.env.ALLOWED_ORIGIN.split(";"), }) );