You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A reusable workflow that handles building and pushing Docker images. It:
52
+
Triggered when a pull request is opened or updated for the main or develop branches. This workflow:
51
53
52
-
1. Sets up Docker Buildx
53
-
2. Logs in to GitHub Container Registry
54
-
3. Extracts metadata for proper tagging
55
-
4. Builds and optionally pushes the Docker image
56
-
5. Supports tagging with semver and latest
54
+
1. Runs tests for the server package
55
+
56
+
### Reusable Workflows
57
+
58
+
#### Test Workflow (`reusable-test.yml`)
59
+
60
+
A reusable workflow that handles testing. It:
61
+
62
+
1. Sets up Node.js (v22) and pnpm
63
+
2. Builds the application
64
+
3. Runs tests and collects coverage
65
+
4. Uploads test results and coverage reports as artifacts
57
66
58
67
### Shared Actions
59
68
60
69
#### Setup Node and pnpm (`setup-node-pnpm`)
61
70
62
-
Sets up Node.js and pnpm with caching for faster installations.
71
+
Sets up Node.js (v22) and pnpm with caching for faster installations. Uses non-frozen lockfile to ensure compatibility.
63
72
64
73
#### Validate Semver Tag (`validate-semver-tag`)
65
74
66
75
Validates that a tag follows semantic versioning format (v*.*.*)
67
76
68
-
#### Test Report (`test-report`)
77
+
## Dependencies
78
+
79
+
The workflows expect jsdom to be included in the package.json of the server application for DOM testing with Vitest.
80
+
81
+
## Docker Images
82
+
83
+
The workflow uses GitHub's official Docker actions directly:
84
+
-`docker/setup-buildx-action` - For setting up Docker Buildx
85
+
-`docker/login-action` - For authenticating with GitHub Container Registry
86
+
-`docker/metadata-action` - For generating image tags and labels
87
+
-`docker/build-push-action` - For building and pushing Docker images
88
+
89
+
Important Docker build configuration:
90
+
- Context is set to the repository root (`.`)
91
+
- Dockerfile path is explicitly set to `apps/server/Dockerfile`
92
+
- Cache is enabled for faster builds using GitHub Actions cache
93
+
94
+
### Simplified Dockerfile Structure
69
95
70
-
Runs tests and generates reports with coverage information.
96
+
The Dockerfile has been simplified to use a two-stage build approach:
71
97
72
-
## Required Dependencies
98
+
1.**Builder Stage**:
99
+
- Uses Node.js 22 Alpine as the base image
100
+
- Copies the entire repository into the container
101
+
- Installs dependencies with `--no-frozen-lockfile` to avoid dependency conflicts
102
+
- Builds the application using the pnpm filter
73
103
74
-
The testing workflow requires the `jsdom` package to be available for DOM testing with Vitest. This dependency is automatically installed during the workflow execution.
104
+
2.**Production Stage**:
105
+
- Uses a fresh Node.js Alpine image
106
+
- Copies only the built application and package.json
107
+
- Installs only production dependencies
108
+
- Results in a smaller final image with no build tools or source code
75
109
76
110
## Badges
77
111
78
112
Workflow status can be displayed in the README.md using the following badge:
1.**Missing dependencies**: Ensure all required dependencies are either in the package.json or installed during workflow execution
89
-
2.**Tag format**: Ensure tags follow the semantic versioning format v*.*.* (e.g., v1.0.0)
90
-
3.**Test failures**: Look at test artifacts for details on failing tests
122
+
1.**Missing dependencies**: Ensure all required dependencies are in the package.json
123
+
2.**Node.js version**: The workflow expects Node.js v22+ as specified in the server package.json
124
+
3.**Tag format**: Ensure release tags follow the semantic versioning format v*.*.* (e.g., v1.0.0)
125
+
4.**Test failures**: Look at test artifacts for details on failing tests
126
+
5.**Docker build context**: The Dockerfile expects to be built from the repository root. If you modify the workflows, ensure the Docker context is set to `.` (repository root) and the file parameter points to `apps/server/Dockerfile`
0 commit comments