From 386b3530936271a2ff27a9f545e3715d93ac76e0 Mon Sep 17 00:00:00 2001 From: Jatin Katyal Date: Sun, 18 Apr 2021 13:44:57 +0530 Subject: [PATCH] add: cron to generate periodically --- Dockerfile | 12 +++++++++--- crontab.txt | 1 + docker-compose.yml | 2 +- nginx.conf | 9 +++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 crontab.txt create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index 5944bdb..368127f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,13 @@ FROM node:12.16.3-alpine # Add support for https on wget -RUN apk update && apk add --no-cache wget && apk --no-cache add openssl wget && apk add ca-certificates && update-ca-certificates +RUN apk update && apk add --no-cache wget nginx && apk --no-cache add openssl wget && apk add ca-certificates && update-ca-certificates + +RUN mkdir -p /run/nginx +COPY nginx.conf /etc/nginx/conf.d/wakanda.conf + +COPY crontab.txt ./ +RUN crontab crontab.txt WORKDIR /usr/src/certificate-worker @@ -10,6 +16,6 @@ COPY package-lock.json ./ RUN npm install COPY . . -RUN npm run build +RUN npm run generate -ENTRYPOINT ["npm", "run", "start"] +ENTRYPOINT ["nginx", "-g", "daemon off;"] diff --git a/crontab.txt b/crontab.txt new file mode 100644 index 0000000..1b17256 --- /dev/null +++ b/crontab.txt @@ -0,0 +1 @@ +* * * * * cd /usr/src/certificate-worker && yarn generate > /var/log/cron.log diff --git a/docker-compose.yml b/docker-compose.yml index b11236b..3027e2e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,5 +4,5 @@ services: image: codingblocks/main-website build: . ports: - - "3000:3000" + - "3000:80" diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..5a40cf4 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,9 @@ +server { + listen 80; + server_name ~^(.+)$; + + location / { + alias /usr/src/certificate-worker/dist/; + try_files $uri / /index.html; + } +}