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
| **`working-directory`** | Working directory where the dependencies are installed. | **false** | **string** | `.` |
115
+
| **`container`** | Docker container image to run CI steps in. When specified, steps will execute inside this container instead of checking out code. The container should have the project code and dependencies pre-installed. | **false** | **string** | `` |
110
116
111
117
<!-- inputs:end -->
112
118
@@ -168,6 +174,54 @@ jobs:
168
174
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
169
175
```
170
176
177
+
### Continuous Integration in a Docker container
178
+
179
+
This example runs CI checks inside a pre-built Docker container that contains the project code and dependencies. This ensures the same environment that will be deployed to production is tested.
180
+
181
+
```yaml
182
+
name: Continuous Integration - Container Mode
183
+
184
+
on:
185
+
push:
186
+
branches: [main]
187
+
188
+
jobs:
189
+
# Build the Docker image with project code and dependencies
190
+
build-image:
191
+
runs-on: ubuntu-latest
192
+
steps:
193
+
- name: Checkout
194
+
uses: actions/checkout@v4.2.2
195
+
196
+
- name: Build Docker image
197
+
run: |
198
+
docker build -t my-app:${{ github.sha }} .
199
+
200
+
- name: Push to registry
201
+
run: |
202
+
docker tag my-app:${{ github.sha }} ghcr.io/${{ github.repository }}:${{ github.sha }}
Copy file name to clipboardExpand all lines: .github/workflows/continuous-integration.yml
+37-8Lines changed: 37 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,11 @@ on:
50
50
type: string
51
51
required: false
52
52
default: "."
53
+
container:
54
+
description: "Docker container image to run CI steps in. When specified, steps will execute inside this container instead of checking out code. The container should have the project code and dependencies pre-installed."
0 commit comments