-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile
More file actions
78 lines (59 loc) · 1.68 KB
/
Copy pathDockerfile
File metadata and controls
78 lines (59 loc) · 1.68 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
ARG NODE_BUILD_VERSION=24
ARG NODE_VERSION=24
FROM docker.io/node:${NODE_BUILD_VERSION} AS build
WORKDIR /usr/src/harper
COPY . .
RUN env NO_USE_GIT=true npm run package
FROM docker.io/node:${NODE_VERSION} AS run
# Change node user to harper
RUN <<-EOF
mkdir -p /home/harperdb
usermod -d /home/harperdb -l harperdb node
groupmod -n harperdb node
rm -rf /home/node
chown -R harperdb:harperdb /home/harperdb
EOF
# Create entrypoint that selects runtime via HARPER_RUNTIME env var
RUN <<-'EOF' > /usr/local/bin/docker-entrypoint.sh
#!/bin/sh
set -e
if [ "$HARPER_RUNTIME" = "bun" ]; then
exec bun "$(which harper)" "$@"
else
exec harper "$@"
fi
EOF
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
WORKDIR /home/harperdb
USER harperdb
# Install pnpm
RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.bashrc" SHELL="$(which bash)" bash -
# Install Bun
RUN curl -fsSL https://bun.sh/install | bash
COPY --from=build /usr/src/harper/harper-*.tgz .
# Configure NPM and Bun paths
ENV NPM_CONFIG_PREFIX=/home/harperdb/.npm-global
ENV PATH=/home/harperdb/.npm-global/bin:/home/harperdb/.bun/bin:$PATH
VOLUME /home/harperdb/harper
# Install Harper globally
RUN <<-EOF
npm install --ignore-scripts --global harper-*.tgz
rm harper-*.tgz
mkdir -p /home/harperdb/harper
chown harperdb:harperdb /home/harperdb/harper
EOF
# Harper config parameters
ENV HDB_ADMIN_USERNAME=admin
ENV HDB_ADMIN_PASSWORD=password
ENV ROOTPATH=/home/harperdb/harper
ENV TC_AGREEMENT=yes
ENV OPERATIONSAPI_NETWORK_PORT=9925
ENV LOGGING_STDSTREAMS=true
ENV NODE_HOSTNAME=localhost
ENV DEFAULTS_MODE=prod
EXPOSE 9925
EXPOSE 9926
EXPOSE 9932
EXPOSE 9933
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["run"]