Skip to content

Commit

Permalink
chore: dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
chareice committed Oct 21, 2022
1 parent 828b28e commit 65724de
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
43 changes: 32 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
FROM node:16-stretch-slim
FROM node:16 as builder
#RUN yarn global add verdaccio
#RUN verdaccio &
RUN yarn config set registry http://localhost:4873/
WORKDIR /tmp
COPY . /tmp
RUN cd /tmp && yarn install && yarn build
RUN git checkout -b release \
&& yarn version:alpha -y \
&& git config user.email "test@mail.com" \
&& git config user.name "test" && git add . \
&& git commit -m "chore(versions): test publish packages xxx" \
&& yarn release:force --registry http://localhost:4873

WORKDIR /app/nocobase
WORKDIR /app
RUN cd /app \
&& yarn create nocobase-app my-nocobase-app -a -e APP_ENV=production \
&& cd /app/my-nocobase-app \
&& yarn install --production

# COPY ./docker/nocobase/sources.list /etc/apt/sources.list
RUN cd /app \
&& rm -rf my-nocobase-app/packages/app/client/src/.umi \
&& rm -rf nocobase.tar.gz \
&& find ./my-nocobase-app/node_modules/china-division/dist -name '*.csv' -delete \
&& find ./my-nocobase-app/node_modules/china-division/dist -name '*.sqlite' -delete \
&& tar -zcf ./nocobase.tar.gz -C /app/my-nocobase-app .


FROM node:16-stretch-slim
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
Expand All @@ -15,17 +38,15 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
*) echo "unsupported architecture"; exit 1 ;; \
esac \
&& set -ex \
# libatomic1 for arm
&& apt-get update && apt-get install -y nginx

RUN rm -rf /etc/nginx/sites-enabled/default
COPY ./docker/nocobase-full/nocobase.conf /etc/nginx/sites-enabled/nocobase.conf
COPY . /app/nocobase
RUN cd /app/nocobase & yarn install
RUN cd /app/nocobase & yarn build
COPY ./docker/nocobase/nocobase.conf /etc/nginx/sites-enabled/nocobase.conf
COPY --from=builder /app/nocobase.tar.gz /app/nocobase.tar.gz

COPY ./docker/nocobase-full/docker-entrypoint.sh /app/
# COPY docker-entrypoint.sh /usr/local/bin/
# ENTRYPOINT ["docker-entrypoint.sh"]
WORKDIR /app/nocobase

COPY ./docker/nocobase/docker-entrypoint.sh /app/

CMD ["/app/docker-entrypoint.sh"]

0 comments on commit 65724de

Please sign in to comment.