mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-20 20:17:38 +00:00
+
This commit is contained in:
parent
08071fba44
commit
bc1f6edc5a
@ -1,8 +1,8 @@
|
|||||||
*
|
*
|
||||||
!package.json
|
!package.json
|
||||||
!yarn.lock
|
!yarn.lock
|
||||||
!docker-entrypoint.sh
|
|
||||||
!build.sh
|
!build.sh
|
||||||
|
!start.sh
|
||||||
!server/*
|
!server/*
|
||||||
!client/*
|
!client/*
|
||||||
**/node_modules/*
|
**/node_modules/*
|
32
Dockerfile
32
Dockerfile
@ -1,35 +1,19 @@
|
|||||||
FROM node:18-bullseye-slim
|
#FROM nginx:alpine3.18
|
||||||
|
FROM node:20.9.0-alpine3.18
|
||||||
|
|
||||||
|
RUN apk update && apk add --no-cache bash
|
||||||
|
|
||||||
USER node:node
|
USER node:node
|
||||||
|
|
||||||
WORKDIR /home/node
|
WORKDIR /home/node
|
||||||
|
|
||||||
# Server environmental variables will be put into server/.env
|
|
||||||
ENV MAILGUN_API_KEY=api-key \
|
|
||||||
MAILGUN_DOMAIN=darkwire.io \
|
|
||||||
ABUSE_TO_EMAIL_ADDRESS=abuse@darkwire.io \
|
|
||||||
ABUSE_FROM_EMAIL_ADDRESS="Darkwire <no-reply@darkwire.io>" \
|
|
||||||
CLIENT_DIST_DIRECTORY='client/dist/'\
|
|
||||||
ROOM_HASH_SECRET='some-uuid'\
|
|
||||||
SITE_URL=https://darkwire.io \
|
|
||||||
STORE_BACKEND=memory
|
|
||||||
|
|
||||||
# Client configuration will be put into client/.env
|
|
||||||
ENV TZ=UTC \
|
|
||||||
VITE_API_HOST=localhost \
|
|
||||||
VITE_API_PROTOCOL=http \
|
|
||||||
VITE_API_PORT=3001 \
|
|
||||||
VITE_COMMIT_SHA=some_sha \
|
|
||||||
VITE_MAX_FILE_SIZE=4
|
|
||||||
|
|
||||||
COPY --chown=node:node . .
|
COPY --chown=node:node . .
|
||||||
|
|
||||||
RUN yarn && yarn build
|
RUN yarn && yarn build
|
||||||
|
|
||||||
STOPSIGNAL SIGINT
|
STOPSIGNAL SIGINT
|
||||||
EXPOSE 3001
|
|
||||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \
|
|
||||||
CMD [ "curl", "-f", "${VITE_API_PROTOCOL}://localhost:${VITE_API_PORT}", "||", "exit", "1" ]
|
|
||||||
|
|
||||||
ENTRYPOINT [ "docker-entrypoint.sh" ]
|
RUN chmod +x /home/node/start.sh
|
||||||
CMD ["yarn", "start"]
|
|
||||||
|
# Start the startup script
|
||||||
|
CMD ["/home/node/start.sh"]
|
2
build.sh
2
build.sh
@ -15,5 +15,5 @@ cd ../
|
|||||||
|
|
||||||
echo "building server..."
|
echo "building server..."
|
||||||
cd server
|
cd server
|
||||||
yarn --production=false
|
yarn --production=true
|
||||||
yarn build
|
yarn build
|
@ -20,5 +20,5 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
build:{
|
build:{
|
||||||
chunkSizeWarningLimit: 1000
|
chunkSizeWarningLimit: 1000
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
@ -3,9 +3,23 @@ services:
|
|||||||
darkwire.io:
|
darkwire.io:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
networks:
|
environment:
|
||||||
- db
|
- TZ=UTC
|
||||||
|
- VITE_API_PORT=80
|
||||||
|
- VITE_API_HOST=localhost
|
||||||
|
- VITE_API_PROTOCOL=http
|
||||||
|
- VITE_COMMIT_SHA=some_sha
|
||||||
|
- VITE_MAX_FILE_SIZE=4
|
||||||
|
- MAILGUN_API_KEY=api-key
|
||||||
|
- MAILGUN_DOMAIN=darkwire.io
|
||||||
|
- ABUSE_TO_EMAIL_ADDRESS=abuse@darkwire.io
|
||||||
|
- ABUSE_FROM_EMAIL_ADDRESS=Darkwire <no-reply@darkwire.io>
|
||||||
|
- CLIENT_DIST_DIRECTORY='client/dist'
|
||||||
|
- ROOM_HASH_SECRET='some-uuid'
|
||||||
|
- SITE_URL=https://darkwire.io
|
||||||
|
- STORE_BACKEND=memory
|
||||||
|
#- STORE_HOST=$STORE_HOST
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
- 3001:3001
|
- 80:80
|
||||||
networks:
|
|
||||||
db:
|
|
||||||
|
@ -20,7 +20,7 @@ dotenv.config();
|
|||||||
const env = process.env.NODE_ENV || 'development';
|
const env = process.env.NODE_ENV || 'development';
|
||||||
|
|
||||||
const app = new Koa();
|
const app = new Koa();
|
||||||
const PORT = process.env.PORT || 3001;
|
const PORT = process.env.VITE_API_PORT;
|
||||||
|
|
||||||
const router = new Router();
|
const router = new Router();
|
||||||
const koaBody = new KoaBody();
|
const koaBody = new KoaBody();
|
||||||
|
17
docker-entrypoint.sh → start.sh
Executable file → Normal file
17
docker-entrypoint.sh → start.sh
Executable file → Normal file
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# We use this file to translate environmental variables to .env files used by the application
|
# We use this file to translate environmental variables to .env files used by the application
|
||||||
|
set_env() {
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ VITE_COMMIT_SHA=$VITE_COMMIT_SHA
|
|||||||
|
|
||||||
# Set max transferable file size in MB
|
# Set max transferable file size in MB
|
||||||
VITE_MAX_FILE_SIZE=$VITE_MAX_FILE_SIZE
|
VITE_MAX_FILE_SIZE=$VITE_MAX_FILE_SIZE
|
||||||
" > client/.env
|
" > client/.env.dist
|
||||||
|
|
||||||
|
|
||||||
echo"
|
echo"
|
||||||
@ -35,6 +35,13 @@ SITE_URL=$SITE_URL
|
|||||||
# Store configuration
|
# Store configuration
|
||||||
STORE_BACKEND=$STORE_BACKEND
|
STORE_BACKEND=$STORE_BACKEND
|
||||||
STORE_HOST=$STORE_HOST
|
STORE_HOST=$STORE_HOST
|
||||||
" > server/.env
|
" > server/.env.dist
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
}
|
||||||
|
set_env &&
|
||||||
|
# Start your application
|
||||||
|
yarn start #&
|
||||||
|
|
||||||
|
# Start Nginx
|
||||||
|
#nginx -g "daemon off;"
|
Loading…
x
Reference in New Issue
Block a user