mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2025-03-18 05:41:43 +01:00
feat: add docker (#6)
* misc: improve match version of types/node * feat: improve stop with sigint signal * feat: add docker * feat: add docker in readme
This commit is contained in:
parent
a1197fc77e
commit
a10aa9c52f
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
README.md
|
||||
LICENSE.txt
|
||||
Dockerfile
|
||||
.vscode
|
||||
.gitignore
|
29
Dockerfile
Normal file
29
Dockerfile
Normal file
@ -0,0 +1,29 @@
|
||||
############################
|
||||
# Docker build environment #
|
||||
############################
|
||||
|
||||
FROM node:18.16.1-bookworm AS build
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm i
|
||||
RUN npm run build
|
||||
|
||||
############################
|
||||
# Docker final environment #
|
||||
############################
|
||||
|
||||
FROM node:18.16.1-bookworm
|
||||
|
||||
EXPOSE 3333
|
||||
EXPOSE 3334
|
||||
EXPOSE 8332
|
||||
|
||||
WORKDIR /public-pool
|
||||
|
||||
COPY --from=build /build .
|
||||
COPY .env.example .env
|
||||
|
||||
CMD ["/usr/local/bin/node", "dist/main"]
|
23
README.md
23
README.md
@ -23,8 +23,6 @@ $ npm run start:dev
|
||||
$ npm run build
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Test
|
||||
|
||||
```bash
|
||||
@ -36,12 +34,33 @@ $ npm run test:cov
|
||||
```
|
||||
|
||||
## Web interface
|
||||
|
||||
See [public-pool-ui](https://github.com/benjamin-wilson/public-pool-ui)
|
||||
|
||||
## Deployment
|
||||
|
||||
Install pm2 (https://pm2.keymetrics.io/)
|
||||
|
||||
```bash
|
||||
$ pm2 start dist/main.js
|
||||
```
|
||||
|
||||
## Docker
|
||||
|
||||
Build container:
|
||||
|
||||
```bash
|
||||
$ docker build -t public-pool .
|
||||
```
|
||||
|
||||
Run container (with default configuration):
|
||||
|
||||
```bash
|
||||
$ docker container run --name public-pool --rm -p 3333:3333 -p 3334:3334 -p 8332:8332 public-pool
|
||||
```
|
||||
|
||||
Run container (with custom configuration):
|
||||
|
||||
```bash
|
||||
$ docker container run --name public-pool --rm -p 3333:3333 -p 3334:3334 -p 8332:8332 -v .env:.env public-pool
|
||||
```
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -45,7 +45,7 @@
|
||||
"@types/cron": "^2.0.1",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/jest": "29.5.1",
|
||||
"@types/node": "18.16.12",
|
||||
"@types/node": "^18.16.12",
|
||||
"@types/node-telegram-bot-api": "^0.61.6",
|
||||
"@types/supertest": "^2.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
||||
|
@ -56,7 +56,7 @@
|
||||
"@types/cron": "^2.0.1",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/jest": "29.5.1",
|
||||
"@types/node": "18.16.12",
|
||||
"@types/node": "^18.16.12",
|
||||
"@types/node-telegram-bot-api": "^0.61.6",
|
||||
"@types/supertest": "^2.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
||||
|
@ -25,7 +25,6 @@ async function bootstrap() {
|
||||
cert: readFileSync(`${currentDirectory}/secrets/cert.pem`),
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter(options));
|
||||
@ -38,10 +37,15 @@ async function bootstrap() {
|
||||
forbidUnknownValues: true
|
||||
}),
|
||||
);
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
console.log(`Stopping services`);
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
app.enableCors();
|
||||
useContainer(app.select(AppModule), { fallbackOnErrors: true });
|
||||
|
||||
|
||||
//Taproot
|
||||
bitcoinjs.initEccLib(ecc);
|
||||
|
||||
@ -50,4 +54,5 @@ async function bootstrap() {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
|
Loading…
x
Reference in New Issue
Block a user