fix: docker build
This commit is contained in:
@@ -46,7 +46,6 @@ const commander = program
|
||||
.option(
|
||||
'--encrypt_enable',
|
||||
'enable encrypt security field, please remember encrypt key.',
|
||||
false,
|
||||
)
|
||||
.option(
|
||||
'--encrypt_algorithm <string>',
|
||||
|
||||
@@ -4,10 +4,14 @@ services:
|
||||
app:
|
||||
container_name: mx-server
|
||||
image: innei/mx-server:latest
|
||||
command: node index.js --redis_host=redis --db_host=mongo --allowed_origins=${ALLOWED_ORIGINS} --jwt_secret=${JWT_SECRET} --color --encrypt_key=${ENCRYPT_KEY} --encrypt_enable=${ENCRYPT_ENABLE}
|
||||
command: sh ./docker-run.sh
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- NODE_ENV=production
|
||||
- ALLOWED_ORIGINS
|
||||
- JWT_SECRET
|
||||
- ENCRYPT_KEY
|
||||
- ENCRYPT_ENABLE
|
||||
volumes:
|
||||
- ./data/mx-space:/root/.mx-space
|
||||
ports:
|
||||
|
||||
16
docker-run.sh
Normal file
16
docker-run.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
command="node index.js --redis_host=redis --db_host=mongo \
|
||||
--allowed_origins=${ALLOWED_ORIGINS} \
|
||||
--jwt_secret=${JWT_SECRET} \
|
||||
--color"
|
||||
|
||||
if [ -n "$ENCRYPT_KEY" ]; then
|
||||
command+=" --encrypt_key=${ENCRYPT_KEY}"
|
||||
fi
|
||||
|
||||
if [ "$ENCRYPT_ENABLE" = "true" ]; then
|
||||
command+=" --encrypt_enable "
|
||||
fi
|
||||
|
||||
exec $command
|
||||
@@ -14,6 +14,7 @@ RUN apk add zip unzip mongodb-tools bash fish rsync jq curl --no-cache
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/out .
|
||||
COPY --from=builder /app/assets ./assets
|
||||
COPY ./docker-run.sh .
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
EXPOSE 2333
|
||||
|
||||
@@ -18,9 +18,7 @@ if [[ $? -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl https://cdn.jsdelivr.net/gh/mx-space/mx-server@master/docker-compose.yml >docker-compose.yml
|
||||
|
||||
docker-compose up -d
|
||||
(docker-compose up &)
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "failed to run docker-compose instance"
|
||||
|
||||
Reference in New Issue
Block a user