2019-10-03 08:09:56 +08:00
|
|
|
FROM node:alpine
|
|
|
|
RUN apk add python build-base
|
|
|
|
COPY . /build
|
|
|
|
WORKDIR /build
|
2019-12-08 19:44:18 +08:00
|
|
|
RUN set -x && npm install --unsafe-perm && npm run create-release && \
|
2019-10-03 08:09:56 +08:00
|
|
|
cd /build/release && npm install --unsafe-perm
|
|
|
|
RUN mkdir -p /build/release/data/config && \
|
|
|
|
mkdir -p /build/release/data/db && \
|
|
|
|
mkdir -p /build/release/data/image && \
|
|
|
|
mkdir -p /build/release/data/TEMP && \
|
|
|
|
cd /build/release && node backend/server.js && \
|
|
|
|
sed -i 's/demo/data/g' config.json && sed -i 's@sqlite\.db@data/db/sqlite\.db@' config.json && \
|
|
|
|
mv /build/release/config.json /build/release/data/config/config.json
|
|
|
|
|
|
|
|
FROM node:alpine
|
|
|
|
WORKDIR /app
|
|
|
|
ENTRYPOINT ["npm", "start"]
|
|
|
|
EXPOSE 80
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
COPY --from=0 /build/release /app
|
|
|
|
RUN ln -s /app/data/config/config.json config.json
|
|
|
|
VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/TEMP"]
|
2019-10-03 08:56:20 +08:00
|
|
|
HEALTHCHECK --interval=15s --timeout=5s --retries=4 --start-period=30s \
|
|
|
|
CMD wget --quiet --tries=1 --no-check-certificate --spider \
|
|
|
|
http://localhost:80 || exit 1
|