Updating Dockerfile for multistage build based on feedbacks

This commit is contained in:
Julien Recurt
2024-05-21 11:27:02 +02:00
parent a431fab3c4
commit d161411416
2 changed files with 15 additions and 8 deletions
+5
View File
@@ -11,8 +11,13 @@
# Ignore git and cache folders
.git
.gitignore
.cache
# Ignore build folders
node_modules
dist
# Ignore default volumes created by running docker compose up
ontime-db
ontime-styles
+10 -8
View File
@@ -1,11 +1,13 @@
FROM node:18.18-alpine as builder
ENV NODE_ENV=docker
ENV ONTIME_DATA=/external/
WORKDIR /app/
RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh -
COPY . /app/
RUN PNPM_HOME="/root/.local/share/pnpm" PATH="${PATH}:/root/.local/share/pnpm" pnpm i
run PNPM_HOME="/root/.local/share/pnpm" PATH="${PATH}:/root/.local/share/pnpm" pnpm run build:localdocker
FROM node:18.18-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
FROM base AS builder
COPY . /app
WORKDIR /app
RUN pnpm install --frozen-lockfile \
&& pnpm turbo build:docker
FROM node:18.18-alpine