mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-09 08:19:15 +00:00
Merge pull request #983 from thelan/docker-multistage
Multistage docker build
This commit is contained in:
@@ -11,4 +11,13 @@
|
|||||||
|
|
||||||
# Ignore git and cache folders
|
# Ignore git and cache folders
|
||||||
.git
|
.git
|
||||||
|
.gitignore
|
||||||
.cache
|
.cache
|
||||||
|
|
||||||
|
# Ignore build folders
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Ignore default volumes created by running docker compose up
|
||||||
|
ontime-db
|
||||||
|
ontime-styles
|
||||||
|
|||||||
@@ -88,8 +88,6 @@ While it should allow for a generic setup, it might need to be modified to fit y
|
|||||||
|
|
||||||
From the project root, run the following commands
|
From the project root, run the following commands
|
||||||
|
|
||||||
- __Install the project dependencies__ by running `pnpm i`
|
|
||||||
- __Build packages__ by running `pnpm build:localdocker`
|
|
||||||
- __Build docker image from__ by running `docker build -t getontime/ontime`
|
- __Build docker image from__ by running `docker build -t getontime/ontime`
|
||||||
- __Run docker image from compose__ by running `docker-compose up -d`
|
- __Run docker image from compose__ by running `docker-compose up -d`
|
||||||
|
|
||||||
|
|||||||
+15
-4
@@ -1,3 +1,14 @@
|
|||||||
|
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
|
FROM node:18.18-alpine
|
||||||
|
|
||||||
# Set environment variables
|
# Set environment variables
|
||||||
@@ -9,12 +20,12 @@ ENV ONTIME_DATA=/external/
|
|||||||
WORKDIR /app/
|
WORKDIR /app/
|
||||||
|
|
||||||
# Prepare UI
|
# Prepare UI
|
||||||
COPY /apps/client/build ./client/
|
COPY --from=builder /app/apps/client/build ./client/
|
||||||
|
|
||||||
# Prepare Backend
|
# Prepare Backend
|
||||||
COPY /apps/server/dist/ ./server/
|
COPY --from=builder /app/apps/server/dist/ ./server/
|
||||||
COPY /demo-db/ ./preloaded-db/
|
COPY ./demo-db/ ./preloaded-db/
|
||||||
COPY /apps/server/src/external/ ./external/
|
COPY --from=builder /app/apps/server/src/external/ ./external/
|
||||||
|
|
||||||
# Export default ports
|
# Export default ports
|
||||||
EXPOSE 4001/tcp 8888/udp 9999/udp
|
EXPOSE 4001/tcp 8888/udp 9999/udp
|
||||||
|
|||||||
Reference in New Issue
Block a user