Skip to content

ci: fix docker CI with lts-alpine #1899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
#
# --- Base Node Image ---
FROM node:14-alpine AS base
############################################################
# Build stage
############################################################
FROM node:lts-alpine AS base

RUN apk update; \
apk add git;

WORKDIR /src

# Copy package.json first to benefit from layer caching
COPY package*.json ./
RUN npm install --only=production

# Install without scripts otherwise webpack will fail
RUN npm ci --production --ignore-scripts

# Copy production node_modules aside for later
RUN cp -R node_modules prod_node_modules
# Install remaining dev dependencies
RUN npm install

# Copy src to have webpack config files ready for install
COPY . /src

# Install remaining dev dependencies
RUN npm ci

# Run all webpack build steps
RUN npm run prepare && npm run build


#
# --- Production Image ---
FROM node:14-alpine AS release
############################################################
# Release stage
############################################################
FROM node:lts-alpine AS release
WORKDIR /src

# Copy production node_modules
Expand Down