Skip to content
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: 4 additions & 0 deletions .github/workflows/pull-request-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
IMAGE_TAG: pr-${{ github.event.number }}
secrets:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
tests:
uses: ./.github/workflows/tests.yml
secrets:
TC_CLOUD_TOKEN: ${{ secrets.TC_CLOUD_TOKEN }}
scout:
permissions:
pull-requests: write
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test with TestContainers

on:
workflow_call:
secrets:
TC_CLOUD_TOKEN:
required: true

jobs:
server-test:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Setup Testcontainers Cloud Client
uses: atomicjar/testcontainers-cloud-setup-action@v1
with:
token: ${{ secrets.TC_CLOUD_TOKEN }}

- name: Run tests
uses: actions/setup-node@v4
with:
node-version: '23.10.0'
- run: npm install
- run: npm test

# (Optionally) When you don't need Testcontainers anymore, you could terminate sessions eagerly
- name: Terminate Testcontainers Cloud Client active sessions
uses: atomicjar/testcontainers-cloud-setup-action@v1
with:
action: terminate
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
npm ci --omit=dev

# Run the application as a non-root user.
#USER node
USER node

# Copy the rest of the source files into the image.
COPY . .
Expand All @@ -37,4 +37,4 @@
EXPOSE 5002

# Run the application.
CMD npm run start:prod

Check warning on line 40 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push-image / build-and-push-image

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ It is a NodeJS app that uses the llama3.2 model to service prompt requests. It u
- Exec into the container and run `ollama pull llama3.2`
- `dotenv -e .env.dev -- npm run start:dev`

#### Local Tests
- Run `npm test`

### Locally with Docker Compose
I used compose to develop this locally.

Expand Down
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {presets: ['@babel/preset-env']}
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
preset: 'ts-jest',
transform: {
'^.+\\.(ts|tsx)?$': 'ts-jest',
'^.+\\.(js|jsx)$': 'babel-jest',
}
};
Loading