Skip to content

Commit f2f2a55

Browse files
authored
Merge pull request #333 from aldbr/main_FEAT_better-cached-layers-dockerfile
feat: better cache the intermediate layers in the docker build stage
2 parents 1e479ee + 89469f2 commit f2f2a55

5 files changed

Lines changed: 26 additions & 6 deletions

File tree

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.git
3+
.next

.github/workflows/gubbins-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ jobs:
194194
name: gubbins-web
195195
path: /tmp/gubbins-web
196196
retention-days: 1
197+
include-hidden-files: true
198+
197199
# ----------------------------------------------------------------------------#
198200
# In the following jobs, you should: #
199201
# - Replace /tmp/gubbins-web with the path to your extension source code #

Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
# Stage 1: Build the Next.js application
55
FROM node:alpine AS build
66
WORKDIR /app
7-
# Copy the application to the working directory
7+
8+
# Copy the package.json and package-lock.json files to the working directory
89
COPY package*.json ./
9-
COPY packages/diracx-web ./packages/diracx-web
10-
COPY packages/diracx-web-components ./packages/diracx-web-components
10+
COPY packages/diracx-web/package*.json ./packages/diracx-web/
11+
COPY packages/diracx-web-components/package*.json ./packages/diracx-web-components/
1112
# Install the project dependencies
12-
RUN npm ci
13+
RUN npm ci && npm cache clean --force
14+
# Copy the application to the working directory
15+
COPY . .
1316
# Build the static export with telemetry disabled (https://nextjs.org/telemetry)
1417
RUN NEXT_TELEMETRY_DISABLED=1 npm run build
1518

packages/extensions/.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.git
3+
.next

packages/extensions/Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@
44
# Stage 1: Build the Next.js application
55
FROM node:alpine AS build
66
WORKDIR /app
7+
8+
# Copy the package.json and package-lock.json files to the working directory
9+
COPY package*.json ./
10+
# =============================================================================
11+
# This line is not necessary in your extension
12+
# -----------------------------------------------------------------------------
13+
COPY diracx-web-components.tgz ./
14+
# =============================================================================
15+
16+
# Install the project dependencies
17+
RUN npm ci && npm cache clean --force
718
# Copy the application to the working directory
819
COPY . .
9-
# Install the project dependencies
10-
RUN npm ci
1120
# Build the static export with telemetry disabled (https://nextjs.org/telemetry)
1221
RUN NEXT_TELEMETRY_DISABLED=1 npm run build
1322

0 commit comments

Comments
 (0)