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
|
||||
!yarn.lock
|
||||
!docker-entrypoint.sh
|
||||
!build.sh
|
||||
!start.sh
|
||||
!server/*
|
||||
!client/*
|
||||
**/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
|
||||
|
||||
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 . .
|
||||
|
||||
RUN yarn && yarn build
|
||||
|
||||
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" ]
|
||||
CMD ["yarn", "start"]
|
||||
RUN chmod +x /home/node/start.sh
|
||||
|
||||
# Start the startup script
|
||||
CMD ["/home/node/start.sh"]
|
2
build.sh
2
build.sh
@ -15,5 +15,5 @@ cd ../
|
||||
|
||||
echo "building server..."
|
||||
cd server
|
||||
yarn --production=false
|
||||
yarn --production=true
|
||||
yarn build
|
@ -20,5 +20,5 @@ export default defineConfig({
|
||||
},
|
||||
build:{
|
||||
chunkSizeWarningLimit: 1000
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -3,9 +3,23 @@ services:
|
||||
darkwire.io:
|
||||
build:
|
||||
context: .
|
||||
networks:
|
||||
- db
|
||||
environment:
|
||||
- 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:
|
||||
- 3001:3001
|
||||
networks:
|
||||
db:
|
||||
- 80:80
|
||||
|
||||
|
@ -20,7 +20,7 @@ dotenv.config();
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
|
||||
const app = new Koa();
|
||||
const PORT = process.env.PORT || 3001;
|
||||
const PORT = process.env.VITE_API_PORT;
|
||||
|
||||
const router = new Router();
|
||||
const koaBody = new KoaBody();
|
||||
|
15
docker-entrypoint.sh → start.sh
Executable file → Normal file
15
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
|
||||
|
||||
set_env() {
|
||||
set -e
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ VITE_COMMIT_SHA=$VITE_COMMIT_SHA
|
||||
|
||||
# Set max transferable file size in MB
|
||||
VITE_MAX_FILE_SIZE=$VITE_MAX_FILE_SIZE
|
||||
" > client/.env
|
||||
" > client/.env.dist
|
||||
|
||||
|
||||
echo"
|
||||
@ -35,6 +35,13 @@ SITE_URL=$SITE_URL
|
||||
# Store configuration
|
||||
STORE_BACKEND=$STORE_BACKEND
|
||||
STORE_HOST=$STORE_HOST
|
||||
" > server/.env
|
||||
" > server/.env.dist
|
||||
|
||||
exec "$@"
|
||||
}
|
||||
set_env &&
|
||||
# Start your application
|
||||
yarn start #&
|
||||
|
||||
# Start Nginx
|
||||
#nginx -g "daemon off;"
|
Loading…
x
Reference in New Issue
Block a user