mirror of https://github.com/nocodb/nocodb
azrikahar
3 years ago
committed by
Azri Kahar
1 changed files with 28 additions and 36 deletions
@ -1,52 +1,44 @@ |
|||||||
FROM alpine:3.12 |
########### |
||||||
|
# Builder |
||||||
# Bug fix for segfault ( Convert PT_GNU_STACK program header into PT_PAX_FLAGS ) |
########### |
||||||
#RUN apk --update --no-cache add paxctl \ |
FROM node:12 as builder |
||||||
# && paxctl -cm $(which node) |
WORKDIR /usr/src/app |
||||||
|
|
||||||
|
ENV NODE_ENV production |
||||||
|
ENV NC_VERSION 0.6 |
||||||
|
ENV NC_DOCKER 0.6 |
||||||
ENV PORT 8080 |
ENV PORT 8080 |
||||||
ENV NODE_ENV=dev |
|
||||||
#ENV TOOL_DIR=/tool |
|
||||||
ENV NC_VERSION=0.6 |
|
||||||
ENV NC_DOCKER=0.6 |
|
||||||
|
|
||||||
# Create and change to the app directory. |
|
||||||
WORKDIR /usr/src/appTemp |
|
||||||
|
|
||||||
# Copy application dependency manifests to the container image. |
# Copy application dependency manifests to the container image. |
||||||
# A wildcard is used to ensure both package.json AND package-lock.json are copied. |
# A wildcard is used to ensure both package.json AND package-lock.json are copied. |
||||||
# Copying this separately prevents re-running npm install on every code change. |
# Copying this separately prevents re-running npm ci on every code change. |
||||||
#COPY ./build/ ./build/ |
COPY ./package*.json ./ |
||||||
COPY ./docker/main.js ./docker/main.js |
COPY ./docker/main.js ./docker/main.js |
||||||
COPY ./package.json ./ |
|
||||||
COPY ./docker/start.sh /usr/src/appEntry/start.sh |
COPY ./docker/start.sh /usr/src/appEntry/start.sh |
||||||
|
|
||||||
# Install production dependencies. |
# install production dependencies, |
||||||
#RUN npm i ../xc-lib-gui/ && npm install --cache=/usr/src/app/cache --production && npx modclean --patterns="default:*" --run && rm -rf /usr/src/app/cache && rm -rf /root/.npm |
# reduce node_module size with modclean & removing sqlite deps, |
||||||
RUN apk --update --no-cache add \ |
# package built code into app.tar.gz & add execute permission to start.sh |
||||||
nodejs \ |
RUN npm ci --production --quiet \ |
||||||
nodejs-npm \ |
|
||||||
tar\ |
|
||||||
&& npm install --cache=/usr/src/app/cache --production \ |
|
||||||
&& npx modclean --patterns="default:*" --ignore="nc-lib-gui/**,dayjs/**,express-status-monitor/**" --run \ |
&& npx modclean --patterns="default:*" --ignore="nc-lib-gui/**,dayjs/**,express-status-monitor/**" --run \ |
||||||
&& rm -rf ./node_modules/sqlite3/deps \ |
&& rm -rf ./node_modules/sqlite3/deps \ |
||||||
# && rm -rf ./node_modules/nc-lib-gui/lib/dist/_nuxt \ |
&& tar -czf ../appEntry/app.tar.gz ./* \ |
||||||
&& rm -rf /usr/src/app/cache && rm -rf /root/.npm \ |
&& chmod +x /usr/src/appEntry/start.sh |
||||||
&& apk del nodejs-npm \ |
|
||||||
&& tar -czf ../appEntry/app.tar.gz ./* ; rm -rf ./* && chmod +x /usr/src/appEntry/start.sh |
|
||||||
|
|
||||||
|
|
||||||
#COPY ./node_modules/xc-lib/ ./node_modules/xc-lib/ |
########## |
||||||
#COPY ./node_modules/xc-lib-gui/ ./node_modules/xc-lib-gui/ |
# Runner |
||||||
|
########## |
||||||
|
FROM alpine:3.12 |
||||||
WORKDIR /usr/src/app |
WORKDIR /usr/src/app |
||||||
|
|
||||||
# Run the web service on container startup. |
RUN apk --update --no-cache add \ |
||||||
#CMD [ "node", "docker/index.js" ] |
nodejs \ |
||||||
ENTRYPOINT ["sh", "/usr/src/appEntry/start.sh"] |
tar |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Copy packaged production code & main entry file |
||||||
|
COPY --from=builder /usr/src/appEntry/ /usr/src/appEntry/ |
||||||
|
|
||||||
|
EXPOSE 8080 |
||||||
|
|
||||||
|
# Start Nocodb |
||||||
|
ENTRYPOINT ["sh", "/usr/src/appEntry/start.sh"] |
Loading…
Reference in new issue