ci: fix docker build with node:lts-alpine (#7663)

This commit is contained in:
Manuel
2021-10-29 17:57:37 +02:00
committed by GitHub
parent f1238eaf57
commit e1f8de80a7

View File

@@ -1,20 +1,30 @@
############################################################
# Build stage # Build stage
############################################################
FROM node:lts-alpine as build FROM node:lts-alpine as build
RUN apk update; \ RUN apk update; \
apk add git; apk add git;
WORKDIR /tmp WORKDIR /tmp
# Copy package.json first to benefit from layer caching
COPY package*.json ./ COPY package*.json ./
# Copy local dependencies for CI tests # Copy src to have config files for install
COPY spec/dependencies spec/dependencies
RUN npm cache clean --force
RUN npm ci
COPY . . COPY . .
# Clean npm cache; added to fix an issue with the install process
RUN npm cache clean --force
# Install all dependencies
RUN npm ci
# Run build steps
RUN npm run build RUN npm run build
############################################################
# Release stage # Release stage
############################################################
FROM node:lts-alpine as release FROM node:lts-alpine as release
RUN apk update; \ RUN apk update; \
@@ -26,6 +36,7 @@ WORKDIR /parse-server
COPY package*.json ./ COPY package*.json ./
# Clean npm cache; added to fix an issue with the install process
RUN npm cache clean --force RUN npm cache clean --force
RUN npm ci --production --ignore-scripts RUN npm ci --production --ignore-scripts