[修改]修改了panel的dockerfile,变更为容器内运行
This commit is contained in:
@@ -11,15 +11,17 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- node-exporter
|
- node-exporter
|
||||||
panel:
|
panel:
|
||||||
build: docker/panel
|
build: management-panel
|
||||||
volumes:
|
# volumes:
|
||||||
- ./management-panel:/app
|
# - ./management-panel:/app
|
||||||
entrypoint: php artisan serve --host=0.0.0.0
|
entrypoint: /app/entrypoint.sh
|
||||||
|
command: php artisan octane:start --server=swoole --workers=4 --host=0.0.0.0 --port=8000
|
||||||
ports:
|
ports:
|
||||||
- 8000:8000
|
- 8000:8000
|
||||||
depends_on:
|
depends_on:
|
||||||
- etcd
|
- etcd
|
||||||
- prometheus
|
- prometheus
|
||||||
|
restart: always
|
||||||
node-exporter:
|
node-exporter:
|
||||||
build: docker/node_exporter
|
build: docker/node_exporter
|
||||||
# privileged: true
|
# privileged: true
|
||||||
@@ -29,5 +31,3 @@ services:
|
|||||||
- '/:/host:ro'
|
- '/:/host:ro'
|
||||||
opcua-exporter:
|
opcua-exporter:
|
||||||
build: opcua-exporter
|
build: opcua-exporter
|
||||||
## volumes:
|
|
||||||
## - ./data:/data
|
|
||||||
@@ -5,7 +5,7 @@ APP_DEBUG=true
|
|||||||
APP_TIMEZONE=UTC
|
APP_TIMEZONE=UTC
|
||||||
APP_URL=http://localhost
|
APP_URL=http://localhost
|
||||||
|
|
||||||
APP_LOCALE=en
|
APP_LOCALE=zh_CN
|
||||||
APP_FALLBACK_LOCALE=en
|
APP_FALLBACK_LOCALE=en
|
||||||
APP_FAKER_LOCALE=en_US
|
APP_FAKER_LOCALE=en_US
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
FROM openeuler/openeuler:24.03
|
FROM openeuler/openeuler:24.03 AS dev
|
||||||
|
|
||||||
# 设置工作目录
|
## 设置工作目录
|
||||||
WORKDIR /app
|
#WORKDIR /app
|
||||||
|
|
||||||
# 更新系统和安装软件包
|
# 更新系统和安装软件包
|
||||||
RUN dnf update -y && \
|
RUN dnf update -y && \
|
||||||
@@ -41,6 +41,43 @@ RUN npm config set registry https://registry.npmmirror.com && \
|
|||||||
npm install -g yarn && \
|
npm install -g yarn && \
|
||||||
yarn config set registry https://registry.npmmirror.com
|
yarn config set registry https://registry.npmmirror.com
|
||||||
|
|
||||||
|
FROM openeuler/openeuler:24.03 AS runtime
|
||||||
|
RUN dnf update -y \
|
||||||
|
&& dnf install php-cli php-bcmath php-mbstring php-pdo php-pecl-zip php-posix php-sodium php-xml php-intl php-opcache c-ares libcurl openssl brotli -y \
|
||||||
|
&& dnf clean all && rm -rf /var/cache/dnf/*
|
||||||
|
|
||||||
|
RUN mkdir -p /usr/lib64/php/modules/
|
||||||
|
|
||||||
|
COPY --from=dev /usr/lib64/php/modules/zstd.so /usr/lib64/php/modules/zstd.so
|
||||||
|
COPY --from=dev /usr/lib64/php/modules/swoole.so /usr/lib64/php/modules/swoole.so
|
||||||
|
|
||||||
|
RUN echo "extension=/usr/lib64/php/modules/zstd.so" > /etc/php.d/20-zstd.ini \
|
||||||
|
&& echo "extension=/usr/lib64/php/modules/swoole.so" > /etc/php.d/50-swoole.ini
|
||||||
|
|
||||||
|
RUN sed -i 's/memory_limit\s*=.*/memory_limit = 4096M/g' /etc/php.ini
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
FROM dev AS build
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN composer install --no-dev --no-suggest --optimize-autoloader
|
||||||
|
|
||||||
|
RUN yarn \
|
||||||
|
&& rm -rf node_modules \
|
||||||
|
&& cp .env.example .env \
|
||||||
|
&& php artisan key:generate
|
||||||
|
|
||||||
|
FROM runtime AS release
|
||||||
|
|
||||||
|
COPY --from=build /app /app
|
||||||
|
|
||||||
|
RUN chmod +x /app/entrypoint.sh \
|
||||||
|
&& chmod +x /app/artisan
|
||||||
|
|
||||||
# 暴露端口
|
# 暴露端口
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
14
management-panel/entrypoint.sh
Normal file
14
management-panel/entrypoint.sh
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mkdir -p storage/app/{public,tenants}
|
||||||
|
mkdir -p storage/logs
|
||||||
|
|
||||||
|
if [ ! -f /app/storage/app/database.sqlite ]; then
|
||||||
|
cat .env
|
||||||
|
touch /app/storage/app/database.sqlite
|
||||||
|
php artisan migrate --seed --force
|
||||||
|
fi
|
||||||
|
|
||||||
|
php artisan migrate
|
||||||
|
|
||||||
|
$@
|
||||||
Reference in New Issue
Block a user