mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-18 02:44:01 +00:00
Fix dockerfile
This commit is contained in:
parent
27c0214c5e
commit
d2846e1605
12
Dockerfile
12
Dockerfile
@ -1,11 +1,9 @@
|
||||
FROM node:18-alpine3.17
|
||||
|
||||
# Installing yarn
|
||||
RUN apt update -y && \
|
||||
apt install yarn=v1.22.4 -v -y
|
||||
FROM node:18-bullseye-slim
|
||||
|
||||
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 \
|
||||
@ -22,11 +20,11 @@ ENV TZ=UTC \
|
||||
VITE_API_PROTOCOL=http \
|
||||
VITE_API_PORT=3001 \
|
||||
VITE_COMMIT_SHA=some_sha \
|
||||
VITE_MAX_FILE_SIZE=4
|
||||
VITE_MAX_FILE_SIZE=4
|
||||
|
||||
COPY --chown=node:node . .
|
||||
|
||||
RUN yarn build
|
||||
RUN yarn && yarn build
|
||||
|
||||
STOPSIGNAL SIGINT
|
||||
EXPOSE 3001
|
||||
|
5
app.json
5
app.json
@ -50,8 +50,5 @@
|
||||
"required": false
|
||||
}
|
||||
},
|
||||
"image": "heroku/nodejs",
|
||||
"addons": [
|
||||
"heroku-redis"
|
||||
]
|
||||
"image": "heroku/nodejs"
|
||||
}
|
@ -12,6 +12,7 @@ import 'bootstrap/dist/js/bootstrap.bundle.min.js';
|
||||
import configureStore from '@/store/';
|
||||
import Home from '@/components/Home/';
|
||||
import { hasTouchSupport } from '@/utils/dom';
|
||||
import { AlertTriangle } from 'react-feather';
|
||||
|
||||
const store = configureStore();
|
||||
|
||||
@ -45,6 +46,11 @@ const Main = () => {
|
||||
|
||||
const root = createRoot(document.getElementById('root') as HTMLElement);
|
||||
|
||||
if (!window.crypto || !window.crypto.subtle) {
|
||||
window.alert("You must access Darkwire from a secure HTTPS connection.")
|
||||
throw new Error("You must access Darkwire from a secure HTTPS connection.")
|
||||
}
|
||||
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<Main />
|
||||
|
@ -3,7 +3,7 @@ export default class Crypto {
|
||||
this._crypto = window.crypto || false;
|
||||
|
||||
if (!this._crypto || (!this._crypto.subtle && !this._crypto.webkitSubtle)) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,4 +18,7 @@ export default defineConfig({
|
||||
resolve: {
|
||||
alias: [{ find: '@', replacement: resolve(projectRootDir, 'src') }],
|
||||
},
|
||||
build:{
|
||||
chunkSizeWarningLimit: 1000
|
||||
}
|
||||
});
|
||||
|
@ -1,9 +1,5 @@
|
||||
version: '3.0'
|
||||
services:
|
||||
redis:
|
||||
image: redis:6.0.6
|
||||
networks:
|
||||
- db
|
||||
darkwire.io:
|
||||
build:
|
||||
context: .
|
||||
|
25
readme.md
25
readme.md
@ -8,7 +8,7 @@ Simple encrypted web chat. Powered by [socket.io](http://socket.io), the [web cr
|
||||
|
||||
### Darkwire Server
|
||||
|
||||
[Darkwire server](/server) is a Node.js application that requires redis.
|
||||
[Darkwire server](/server) is a Node.js application.
|
||||
|
||||
### Darkwire Web Client
|
||||
|
||||
@ -21,19 +21,20 @@ The Darkwire.io [web client](/client) is written in JavaScript with React JS and
|
||||
Copy `.env.dist` files in `server/` and `client/` directories without the `.dist`
|
||||
extensions and adapt them to your needs.
|
||||
|
||||
You need [Redis](https://redis.io/) in order to make the server works.
|
||||
A simple way to achieve this, if you have docker, is to execute the following
|
||||
command:
|
||||
You must have a https connection for Darkwire to work because it's using crypto browser
|
||||
API which is accessible only on localhost and behind a https connection.
|
||||
|
||||
|
||||
#### Manual setup
|
||||
|
||||
You can use nvm to install the right version of node using this command:
|
||||
|
||||
```
|
||||
docker run --name darkwire-redis --rm -p 6379:6379 -d redis redis-server --appendonly yes
|
||||
nvm install # If not already installed
|
||||
nvm use
|
||||
npm install yarn -g
|
||||
```
|
||||
|
||||
Alternatively, you can select the _memory_ `STORE_BACKEND` instead of _redis_
|
||||
in your server `.env` file to avoid Redis use.
|
||||
|
||||
#### Setup
|
||||
|
||||
Install dependencies
|
||||
|
||||
```
|
||||
@ -55,7 +56,7 @@ Just run the following:
|
||||
$ docker-compose up
|
||||
```
|
||||
|
||||
This will automatically create the default `.env` files, and run redis for you.
|
||||
This will automatically create the default `.env` files for you.
|
||||
|
||||
### Production
|
||||
|
||||
@ -82,7 +83,7 @@ $ docker build --tag darkwire.io:latest .
|
||||
Then run it. Example:
|
||||
|
||||
```
|
||||
$ docker run --name darkwire.io --env STORE_HOST=redis://redis.host:6379 darkwire.io
|
||||
$ docker run --init --name darkwire.io --rm -p 3001:3001 darkwire.io
|
||||
```
|
||||
|
||||
You are able to use any of the enviroment variables available in `server/.env.dist` and `client/.env.dist`. The defaults are available in [Dockerfile](Dockerfile)
|
||||
|
Loading…
x
Reference in New Issue
Block a user