mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 03:46:08 +00:00
feat: full version of the NocoBase dockerfile (#719)
This commit is contained in:
parent
b848b9cd67
commit
f11c0025c0
31
Dockerfile
Normal file
31
Dockerfile
Normal 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"]
|
19
docker/nocobase-full/docker-entrypoint.sh
Executable file
19
docker/nocobase-full/docker-entrypoint.sh
Executable 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 "$@"
|
26
docker/nocobase-full/nocobase.conf
Normal file
26
docker/nocobase-full/nocobase.conf
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user