-
-
Notifications
You must be signed in to change notification settings - Fork 165
/
Copy pathDockerfile
49 lines (36 loc) · 1.02 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
# Set the base image
FROM node:20-bookworm-slim
# WORKDIR /usr/src/app/
WORKDIR /home/gateway
# Create mount points
RUN mkdir -p /home/gateway/conf /home/gateway/logs /home/gateway/db /home/gateway/certs
# Install pnpm
RUN npm install -g pnpm@latest
# Copy package files first
COPY package.json pnpm-lock.yaml ./
# Dockerfile author / maintainer
LABEL maintainer="Michael Feng <[email protected]>"
# Build arguments
ARG BRANCH
ARG COMMIT
ARG BUILD_DATE
# Labels using build args
LABEL branch=${BRANCH}
LABEL commit=${COMMIT}
LABEL date=${BUILD_DATE}
# Set ENV variables
ENV COMMIT_BRANCH=${BRANCH}
ENV COMMIT_SHA=${COMMIT}
ENV BUILD_DATE=${BUILD_DATE}
ENV INSTALLATION_TYPE=docker
ENV DEV=false
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy the rest of the files
COPY . .
# Build
RUN pnpm build
# Expose port 15888 - note that docs port is 8080
EXPOSE 15888
# Set the default command to run when starting the container
CMD ["sh", "-c", "if [ \"$DEV\" = \"true\" ]; then pnpm start --dev; else pnpm start; fi"]