forked from LaserWeb/LaserWeb4
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
57 lines (52 loc) · 1.74 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
# ---- Base Node ----
FROM node:16-bullseye AS base
# set working directory
WORKDIR /usr/src/app
# Set up Apt, install build tooling and udev
RUN apt update
RUN apt install -y build-essential udev
# Upgrade npm and set node options
RUN npm install -g npm
RUN npm set progress=false
# Set the port the container serves on
EXPOSE 8000
#
# ---- comm-server ----
FROM base AS comm-server
# Run npm install and add nodemon + lw comm server from Git
# (Currently use --force to allow for broken deps, this should be removed once the dep tree is fixed
RUN npm install -g nodemon && npm install --force lw.comm-server@git+https://github.com/LaserWeb/lw.comm-server.git
# ---- Release ----
# This will use the git head version of lw.comm-server + the LW app version bundled with that.
# it DOES NOT build and serve the version of LaserWeb in this repo
#
FROM comm-server AS release
WORKDIR /usr/src/app
# define CMD
CMD [ "node", "node_modules/lw.comm-server/server.js"]
#
# ---- Dependencies ----
FROM base AS dependencies
# install node packages
# Run npm install and add nodemon + lw comm server from Git
# (Currently use --force to allow for broken deps, this should be removed once the dep tree is fixed
# copy app sources
COPY . .
RUN npm -force install && npm install --force lw.comm-server@git+https://github.com/LaserWeb/lw.comm-server.git
#
# ---- Bash (helpful for debug) ----
FROM dependencies AS bash
WORKDIR /usr/src/app
# define CMD
CMD [ "bash" ]
#
# ---- Dev ----
FROM dependencies AS dev
WORKDIR /usr/src/app
# Bundle the development build
RUN npm run bundle-dev
# Install into lw-comm-server
RUN rm -rfv node_modules/lw.comm-server/app/* && cp -prv dist/* node_modules/lw.comm-server/app/
# define CMD
CMD [ "node", "node_modules/lw.comm-server/server.js"]