mirror of
https://github.com/cupcakearmy/docker-ddns-cloudflare.git
synced 2024-12-22 07:46:24 +00:00
1.2.0
This commit is contained in:
parent
8904ffcbdd
commit
157ce6b7b6
10
CHANGELOG.md
10
CHANGELOG.md
@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.2.0] - 2022-02-07
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Sigterm and Sigkill hooks for graceful shutdown
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Multistage steps to reduce image size
|
||||||
|
|
||||||
## [1.1.1] - 2022-02-07
|
## [1.1.1] - 2022-02-07
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
19
Dockerfile
19
Dockerfile
@ -1,10 +1,21 @@
|
|||||||
|
FROM node:16-alpine as builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ADD ./package.json ./pnpm-lock.yaml ./
|
||||||
|
RUN npm exec pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
ADD . .
|
||||||
|
RUN npm exec pnpm run build
|
||||||
|
|
||||||
FROM node:16-alpine
|
FROM node:16-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ADD . .
|
ADD ./package.json ./pnpm-lock.yaml ./
|
||||||
RUN npm install -g pnpm
|
RUN npm exec pnpm install --frozen-lockfile --prod
|
||||||
RUN pnpm install --frozen-lockfile
|
COPY --from=builder /app/dist/ /app/dist/
|
||||||
RUN pnpm run build
|
|
||||||
|
STOPSIGNAL SIGTERM
|
||||||
|
|
||||||
CMD ["node", "."]
|
CMD ["node", "."]
|
||||||
|
11
src/index.ts
11
src/index.ts
@ -3,6 +3,7 @@ import Axios from 'axios'
|
|||||||
import { CronJob } from 'cron'
|
import { CronJob } from 'cron'
|
||||||
import { config } from 'dotenv'
|
import { config } from 'dotenv'
|
||||||
import winston from 'winston'
|
import winston from 'winston'
|
||||||
|
import process from 'process'
|
||||||
|
|
||||||
const logger = winston.createLogger({
|
const logger = winston.createLogger({
|
||||||
level: 'info',
|
level: 'info',
|
||||||
@ -107,8 +108,16 @@ async function main() {
|
|||||||
if (changed) await update(cf, { ip, record: DNS_RECORD!, zone: ZONE! }).catch((e) => logger.error(e.message))
|
if (changed) await update(cf, { ip, record: DNS_RECORD!, zone: ZONE! }).catch((e) => logger.error(e.message))
|
||||||
}
|
}
|
||||||
|
|
||||||
new CronJob(CRON || '*/5 * * * *', fn, null, true, undefined, null, true)
|
const cron = new CronJob(CRON || '*/5 * * * *', fn, null, true, undefined, null, true)
|
||||||
logger.info('Started service.')
|
logger.info('Started service.')
|
||||||
|
|
||||||
|
function terminate() {
|
||||||
|
logger.info('Stopping service.')
|
||||||
|
cron.stop()
|
||||||
|
process.exit(0)
|
||||||
|
}
|
||||||
|
process.on('SIGINT', terminate)
|
||||||
|
process.on('SIGTERM', terminate)
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user