Skip to content

Commit 79c3d88

Browse files
committed
build: Run build task inside Docker
1 parent f111d3d commit 79c3d88

File tree

4 files changed

+21
-29
lines changed

4 files changed

+21
-29
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.github/workflows/ci.yaml

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,4 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515

16-
- name: Cache node modules
17-
uses: actions/cache@v2
18-
env:
19-
cache-name: cache-node-modules
20-
with:
21-
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
22-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
23-
restore-keys: |
24-
${{ runner.os }}-build-${{ env.cache-name }}-
25-
${{ runner.os }}-build-
26-
${{ runner.os }}-
27-
28-
- name: Use Node.js ${{ matrix.node-version }}
29-
uses: actions/setup-node@v2
30-
with:
31-
node-version: ${{ matrix.node-version }}
32-
33-
- run: npm ci
34-
35-
- run: npm run build --if-present
36-
env:
37-
RELATIVE_CI_KEY: ${{ secrets.RELATIVE_CI_KEY }}
38-
DEBUG: ${{ secrets.DEBUG }}
39-
40-
- name: Upload artifacts
41-
uses: actions/upload-artifact@v2
42-
with:
43-
name: artifacts
44-
path: artifacts
16+
- run: npm run container-build

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from node:16 as base
2+
3+
ARG CI=true
4+
ARG SERVICE="github-action-docker"
5+
ARG REPOSITORY
6+
ARG BRANCH
7+
ARG PR
8+
ARG BUILD
9+
ARG BUILD_URL
10+
ARG SHA
11+
12+
COPY . /app
13+
WORKDIR /app
14+
15+
from base as build
16+
17+
RUN npm install
18+
RUN DEBUG=relative-ci:* npm run build

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"start": "webpack-dev-server",
88
"build": "webpack --mode production --json artifacts/webpack-stats.json",
9+
"container-build": "docker build . --no-cache-filter=build --progress=plain",
910
"test": "echo \"Error: no test specified\" && exit 0"
1011
},
1112
"keywords": [],

0 commit comments

Comments
 (0)