-
Notifications
You must be signed in to change notification settings - Fork 0
Mrc 6647 ci docker #11
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
5f36112
feat: update dependencies and configuration for Redis and Svelte; ref…
absternator 45ec0a9
secure cookie true and mapping 127.0.0.1 ports
M-Kusumgar c0f6c4f
feat: update Docker Compose to expose Redis and Mintr ports without l…
absternator 62ad3eb
refactor: remove debug logging for user ID and new user state creation
absternator f962a53
Merge branch 'mrc-6774-strategise-display' of https://github.com/mrc-…
absternator 73b1503
fix: update Redis volume mapping and standardize API reference variable
absternator 60d8cae
feat: add GitHub Actions workflows for building, pushing Docker image…
absternator 7e4709d
fix: reorder steps in test workflow for clarity and consistency
absternator 49ba987
docs: add Docker usage instructions and environment variable examples…
absternator 771a2d7
fix: standardize formatting in GitHub Actions workflows and update RE…
absternator 19b181e
Add unit test coverage command and update dependencies
absternator fb03763
feat: add Playwright test workflow and update .gitignore to include c…
absternator e758ef3
fix: standardize variable naming in scripts and improve workflow clarity
absternator 1f87db2
test: enhance test cases for +page.server and +page.svelte components
absternator 7282899
fix: standardize quotes in GitHub Actions workflow configuration
absternator 10f4fda
fix: standardize quote styles in GitHub Actions workflow
absternator f1e5979
fix: handle undefined REDIS_URL in Redis connection initialization
absternator 57f4051
fix: set default Redis URL to 'redis://localhost:6379' for connection…
absternator fb72f72
fix: standardize quote styles in GitHub Actions workflow
absternator 65fa133
fix: standardize quote styles in GitHub Actions workflow
absternator 673b0ea
fix: update Playwright configuration to include parallel testing and …
absternator ae1d34b
fix: update SameSite attribute for userId cookie to 'lax'
absternator 7f69d81
fix: add end-to-end testing workflow to GitHub Actions and remove Pla…
absternator 3e8c929
fix: update README to clarify application readiness before accessing
absternator e182685
fix: remove trailing space in docker-compose command in README
absternator 34e110c
fix: standardize quotes in workflow files and update Node.js setup
absternator 6ad185d
Merge branch 'mrc-6774-strategise-display' of https://github.com/mrc-…
absternator File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| Dockerfile | ||
| .dockerignore | ||
| .git | ||
| .gitignore | ||
| .gitattributes | ||
| README.md | ||
| .npmrc | ||
| .prettierrc | ||
| .eslintrc.cjs | ||
| .graphqlrc | ||
| .editorconfig | ||
| .svelte-kit | ||
| .vscode | ||
| node_modules | ||
| build | ||
| package | ||
| **/.env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: build and push docker image | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - 'releases/*' | ||
| pull_request: | ||
| branches: | ||
| - '*' | ||
| env: | ||
| BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | ||
| IMAGE_NAME: ghcr.io/mrc-ide/mint-frontend | ||
|
|
||
| jobs: | ||
| build-push: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| push: true | ||
| tags: | | ||
| ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }} | ||
| ${{ env.BRANCH_NAME == 'main' && format('{0}:latest', env.IMAGE_NAME) || '' }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| name: test workflow | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - 'releases/*' | ||
| pull_request: | ||
| branches: | ||
| - '*' | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
| - name: Set up Node.js 22.x | ||
| uses: actions/setup-node@v5 | ||
| with: | ||
| node-version: 22.x | ||
| cache: 'npm' | ||
| cache-dependency-path: package-lock.json | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Run format + lint checks | ||
| run: npm run lint | ||
| - name: check svelte-check | ||
| run: npm run check | ||
| - name: Install Playwright Browsers | ||
| run: npx playwright install --with-deps | ||
| - name: Run unit tests | ||
| run: npm run test:unit:coverage | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| slug: mrc-ide/mint-v2 | ||
| fail_ci_if_error: true | ||
| e2e-tests: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| node-version: [22.x] | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
| - name: Set up Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v5 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Start dependencies | ||
| run: ./scripts/run_dependencies.sh | ||
| - name: Install Playwright Browsers | ||
| run: npx playwright install --with-deps | ||
| - name: Run Playwright tests | ||
| run: npm run test:e2e | ||
| - name: Stop dependencies | ||
| if: ${{ always() }} | ||
| run: ./scripts/stop_dependencies.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,3 +23,4 @@ Thumbs.db | |
| # Vite | ||
| vite.config.js.timestamp-* | ||
| vite.config.ts.timestamp-* | ||
| coverage | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| FROM node:22-slim AS builder | ||
| WORKDIR /app | ||
| COPY package*.json ./ | ||
| RUN npm ci | ||
| COPY . . | ||
| RUN npm run build | ||
| RUN npm prune --omit=dev | ||
|
|
||
| FROM builder AS runtime | ||
| WORKDIR /app | ||
| COPY --from=builder /app/build build/ | ||
| COPY --from=builder /app/node_modules node_modules/ | ||
| COPY package.json . | ||
| EXPOSE 3000 | ||
| ENV NODE_ENV=production | ||
| CMD ["node", "build"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,3 +76,30 @@ npx shadcn-svelte@latest add [component-name] | |
| ``` | ||
|
|
||
| These components will be added to `src/lib/components/ui/` and automatically registered in the SvelteKit app. | ||
|
|
||
| ## Docker | ||
|
|
||
| #### Using Docker Compose | ||
|
|
||
| A `compose.yml` file is provided to run the application along with its dependencies (Redis and Mintr API). | ||
|
|
||
| 1. **Start services**: | ||
|
|
||
| ```sh | ||
| docker-compose up | ||
| ``` | ||
|
|
||
| 2. **Access the application**: | ||
| Wait for mint-frontend to be ready. Open your browser and navigate to `http://127.0.0.1:3000`. | ||
| 3. **Stop services**: | ||
|
|
||
| ```sh | ||
| docker-compose down | ||
|
||
| ``` | ||
|
|
||
| ## Environment Variables | ||
|
|
||
| Environment variables can be set in a `.env` file in the root directory or added to the environment. Example variables include: | ||
|
|
||
| - `FRONTEND_REF`: Git reference for the frontend image (default: `main`) | ||
| - `API_REF`: Git reference for the Mintr API image (default: `main`) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| services: | ||
| mint-redis: | ||
| image: redis:8.0 | ||
| ports: | ||
| - 6379:6379 | ||
| volumes: | ||
| - mint-data:/data | ||
| container_name: mint-redis | ||
| mint-frontend: | ||
| image: ghcr.io/mrc-ide/mint-frontend:${FRONTEND_REF:-main} | ||
| pull_policy: always | ||
| ports: | ||
| - 127.0.0.1:3000:3000 | ||
| environment: | ||
| - REDIS_URL=redis://mint-redis:6379 | ||
| - PUBLIC_MINTR_URL=http://mintr:8888 | ||
| - ORIGIN=http://127.0.0.1:3000 | ||
| depends_on: | ||
| mint-redis: | ||
| condition: service_started | ||
| mintr: | ||
| condition: service_healthy | ||
| restart: true | ||
| mintr: | ||
| image: ghcr.io/mrc-ide/mintr:${API_REF:-main} | ||
| container_name: mintr | ||
| healthcheck: | ||
| test: curl -f http://localhost:8888/ || exit 1 | ||
| start_period: 1m | ||
| start_interval: 10s | ||
| interval: 1m | ||
| timeout: 30s | ||
| retries: 5 | ||
| ports: | ||
| - 8888:8888 | ||
| volumes: | ||
| mint-data: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also include
docker compose up --buildto rebuild changes?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not anymore because im using the image from ghcr and not building locally