49 lines
1.2 KiB
Docker
49 lines
1.2 KiB
Docker
FROM node:12-alpine as builder
|
|
|
|
ENV YAPI_VERSION="1.9.2"
|
|
ENV YAPI_HOME="/yapi"
|
|
ENV GIT_URL="https://github.com/YMFE/yapi.git"
|
|
ENV GIT_MIRROR_URL="https://gitee.com/mirrors/YApi.git"
|
|
|
|
WORKDIR ${YAPI_HOME}
|
|
|
|
COPY config.json .
|
|
COPY start.sh .
|
|
|
|
RUN apk add --no-cache wget python make git curl
|
|
RUN chmod +x start.sh
|
|
RUN ret=`curl -s https://api.ip.sb/geoip | grep China | wc -l` && \
|
|
if [ $ret -ne 0 ]; then \
|
|
GIT_URL=${GIT_MIRROR_URL} && npm config set registry https://registry.npm.taobao.org; \
|
|
fi;
|
|
RUN git clone --depth 1 --branch v${YAPI_VERSION} --single-branch ${GIT_URL} vendors
|
|
|
|
WORKDIR ${YAPI_HOME}/vendors
|
|
#RUN npm install -g node-gyp yapi-cli
|
|
RUN npm install --production
|
|
|
|
|
|
FROM node:12-alpine
|
|
|
|
ENV TZ="Asia/Shanghai"
|
|
ENV YAPI_VERSION="1.9.2"
|
|
ENV YAPI_HOME="/yapi"
|
|
ENV YAPI_PORT="3000"
|
|
ENV ADMIN_EMAIL="master@simaek.com"
|
|
ENV DB_HOST="mongo"
|
|
ENV DB_NAME="yapi"
|
|
ENV DB_PORT="27017"
|
|
ENV MAIL_ENABLE="false"
|
|
ENV MAIL_HOST="127.0.0.1"
|
|
ENV MAIL_PORT="465"
|
|
ENV MAIL_FROM="master@simaek.com"
|
|
ENV MAIL_USER="user"
|
|
ENV MAIL_PWD="password"
|
|
|
|
WORKDIR ${YAPI_HOME}
|
|
|
|
COPY --from=builder /yapi .
|
|
|
|
EXPOSE ${YAPI_PORT}
|
|
#ENTRYPOINT ["node", "server/app.js"]
|
|
ENTRYPOINT ["sh", "start.sh"] |