feat: full version of the NocoBase dockerfile (#719)

This commit is contained in:
chenos 2022-08-10 12:46:01 +08:00 committed by GitHub
parent b848b9cd67
commit f11c0025c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 0 deletions

31
Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM node:16-stretch-slim
WORKDIR /app/nocobase
# COPY ./docker/nocobase/sources.list /etc/apt/sources.list
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
ppc64el) ARCH='ppc64le';; \
s390x) ARCH='s390x';; \
arm64) ARCH='arm64';; \
armhf) ARCH='armv7l';; \
i386) ARCH='x86';; \
*) 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-full/docker-entrypoint.sh /app/
# COPY docker-entrypoint.sh /usr/local/bin/
# ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["/app/docker-entrypoint.sh"]

View File

@ -0,0 +1,19 @@
#!/bin/sh
set -e
nginx
echo 'nginx started';
cd /app/nocobase && yarn nocobase db:auth --retry=30
cd /app/nocobase && yarn nocobase install -s
cd /app/nocobase && yarn nocobase upgrade -S
cd /app/nocobase && yarn start
# Run command with node if the first argument contains a "-" or is not a system command. The last
# part inside the "{}" is a workaround for the following bug in ash/dash:
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264
if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then
set -- node "$@"
fi
exec "$@"

View File

@ -0,0 +1,26 @@
server {
listen 80;
server_name _;
root /app/nocobase/packages/app/client/dist;
index index.html;
client_max_body_size 20M;
location /storage/uploads/ {
alias /app/nocobase/storage/uploads/;
autoindex off;
}
location / {
root /app/nocobase/packages/app/client/dist;
try_files $uri $uri/ /index.html;
}
location ^~ /api/ {
proxy_pass http://127.0.0.1:13000/api/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}