Spaces:
Running
Running
Upload Dockerfile
Browse files- Dockerfile +56 -0
Dockerfile
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM node:19.1.0-alpine3.16
|
2 |
+
|
3 |
+
# Arguments
|
4 |
+
ARG APP_HOME=/home/node/app
|
5 |
+
|
6 |
+
# Install system dependencies
|
7 |
+
RUN apk add gcompat tini git jq curl
|
8 |
+
|
9 |
+
# Ensure proper handling of kernel signals
|
10 |
+
ENTRYPOINT [ "tini", "--" ]
|
11 |
+
|
12 |
+
# Create app directory
|
13 |
+
WORKDIR ${APP_HOME}
|
14 |
+
|
15 |
+
# Set NODE_ENV to production
|
16 |
+
ENV NODE_ENV=production
|
17 |
+
|
18 |
+
ENV fetch ""
|
19 |
+
|
20 |
+
# Install app dependencies
|
21 |
+
# COPY package*.json post-install.js ./
|
22 |
+
RUN --mount=type=secret,id=url,mode=0444,required=true \
|
23 |
+
git clone $(cat /run/secrets/url) --branch 1.13.0 .
|
24 |
+
RUN \
|
25 |
+
echo "*** Install npm packages ***" && \
|
26 |
+
npm i --no-audit --no-fund --loglevel=error --no-progress --omit=dev && npm cache clean --force
|
27 |
+
|
28 |
+
# Bundle app source
|
29 |
+
# COPY . ./
|
30 |
+
|
31 |
+
ADD launch.sh launch.sh
|
32 |
+
ADD config config
|
33 |
+
RUN --mount=type=secret,id=async,mode=0444,required=true \
|
34 |
+
curl -JLO $(cat /run/secrets/async)
|
35 |
+
RUN chmod +x launch.sh && chmod +x git-batch && ./git-batch -h
|
36 |
+
|
37 |
+
# Copy default chats, characters and user avatars to <folder>.default folder
|
38 |
+
RUN \
|
39 |
+
rm -f "config.yaml" || true && \
|
40 |
+
ln -s "./config/config.yaml" "config.yaml" || true
|
41 |
+
|
42 |
+
# Cleanup unnecessary files
|
43 |
+
RUN \
|
44 |
+
echo "*** Cleanup ***" && \
|
45 |
+
mv "./docker/docker-entrypoint.sh" "./" && \
|
46 |
+
rm -rf "./docker" && \
|
47 |
+
echo "*** Make docker-entrypoint.sh executable ***" && \
|
48 |
+
chmod +x "./docker-entrypoint.sh" && \
|
49 |
+
echo "*** Convert line endings to Unix format ***" && \
|
50 |
+
dos2unix "./docker-entrypoint.sh"
|
51 |
+
RUN sed -i 's/# Start the server/.\/launch.sh env \&\& .\/launch.sh init/g' docker-entrypoint.sh
|
52 |
+
RUN chmod -R 777 ${APP_HOME}
|
53 |
+
|
54 |
+
EXPOSE 8000
|
55 |
+
|
56 |
+
CMD [ "./docker-entrypoint.sh" ]
|