Optimize github build workflow
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
FROM node:18-alpine AS frontend-builder
|
FROM node:18-alpine AS frontend-builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN --mount=type=cache,target=/root/.npm \
|
RUN npm ci --force && \
|
||||||
npm ci && npm cache clean --force
|
npm cache clean --force
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
@@ -11,8 +11,8 @@ RUN npm run build
|
|||||||
FROM node:18-alpine AS backend-builder
|
FROM node:18-alpine AS backend-builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN --mount=type=cache,target=/root/.npm \
|
RUN npm ci --only=production --force && \
|
||||||
npm ci --only=production && npm cache clean --force
|
npm cache clean --force
|
||||||
COPY src/backend/ ./src/backend/
|
COPY src/backend/ ./src/backend/
|
||||||
|
|
||||||
# Stage 3: Build bcrypt for Ubuntu
|
# Stage 3: Build bcrypt for Ubuntu
|
||||||
@@ -34,7 +34,7 @@ RUN rm -f /var/lib/apt/lists/lock /var/cache/apt/archives/lock /var/lib/dpkg/loc
|
|||||||
wget -qO- https://deb.nodesource.com/setup_${NODE_VERSION} | bash - && \
|
wget -qO- https://deb.nodesource.com/setup_${NODE_VERSION} | bash - && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y nodejs && \
|
apt-get install -y nodejs && \
|
||||||
npm ci --only=production bcrypt && \
|
npm ci --only=production bcrypt --force && \
|
||||||
npm cache clean --force && \
|
npm cache clean --force && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/* /var/cache/apt/* /tmp/*
|
rm -rf /var/lib/apt/lists/* /var/cache/apt/* /tmp/*
|
||||||
@@ -83,8 +83,7 @@ RUN chown -R www-data:www-data /usr/share/nginx/html
|
|||||||
# Setup backend
|
# Setup backend
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN --mount=type=cache,target=/root/.npm \
|
RUN npm ci --only=production --ignore-scripts --force && \
|
||||||
npm ci --only=production --ignore-scripts && \
|
|
||||||
npm cache clean --force && \
|
npm cache clean --force && \
|
||||||
rm -rf /tmp/*
|
rm -rf /tmp/*
|
||||||
COPY --from=bcrypt-builder /app/node_modules/bcrypt /app/node_modules/bcrypt
|
COPY --from=bcrypt-builder /app/node_modules/bcrypt /app/node_modules/bcrypt
|
||||||
|
|||||||
Reference in New Issue
Block a user