From 278e1c4a954fabf81a926b75a23ceadfaa4d48cd Mon Sep 17 00:00:00 2001 From: ntr Date: Wed, 6 Dec 2023 11:50:45 +1100 Subject: [PATCH 1/2] typo --- api/src/routers/router.auth.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/routers/router.auth.ts b/api/src/routers/router.auth.ts index 5c2cf1a..9b2f3a3 100644 --- a/api/src/routers/router.auth.ts +++ b/api/src/routers/router.auth.ts @@ -70,7 +70,7 @@ export default function authRouter(log, pg: Pg, events) { id: user.id, email: user.email, }; - events.emit(Events.DiscordMessage, { msg: 'user registere', email: user.email }); + events.emit(Events.DiscordMessage, { msg: 'user register', email: user.email }); }); return { authRouter, passport }; From 3a0525fffec4f4bad2fee587c42b55ebe59e8b69 Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 18 Dec 2023 22:44:12 +1100 Subject: [PATCH 2/2] k8s and dockerfiles --- api/api.Dockerfile | 4 ++++ client/client.Dockerfile | 12 ++++++++++ client/client.nginx.conf | 49 ++++++++++++++++++++++++++++++++++++++++ docker-compose.K8S.yaml | 14 ++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 api/api.Dockerfile create mode 100644 client/client.Dockerfile create mode 100644 client/client.nginx.conf create mode 100644 docker-compose.K8S.yaml diff --git a/api/api.Dockerfile b/api/api.Dockerfile new file mode 100644 index 0000000..561cec0 --- /dev/null +++ b/api/api.Dockerfile @@ -0,0 +1,4 @@ +FROM node:16 +WORKDIR /opt/crates/api +COPY . ./ +CMD ["npm", "start"] diff --git a/client/client.Dockerfile b/client/client.Dockerfile new file mode 100644 index 0000000..283a080 --- /dev/null +++ b/client/client.Dockerfile @@ -0,0 +1,12 @@ +# build step +FROM node:16 AS build-env +WORKDIR /opt/crates/client + +COPY . ./ +RUN npm run build + +# static server +FROM nginx +WORKDIR /srv/app +COPY --from=build-env /opt/crates/client/build /srv/app +COPY ./client.nginx.conf /etc/nginx/nginx.conf diff --git a/client/client.nginx.conf b/client/client.nginx.conf new file mode 100644 index 0000000..5ef9d72 --- /dev/null +++ b/client/client.nginx.conf @@ -0,0 +1,49 @@ +events { + worker_connections 1024; +} + +http { + include mime.types; + sendfile on; + + server { + listen 8080; + listen [::]:8080; + + autoindex off; + + root /srv/app; + + gzip on; + gzip_disable "msie6"; + + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_min_length 256; + gzip_types + application/atom+xml + application/geo+json + application/javascript + application/x-javascript + application/json + application/ld+json + application/manifest+json + application/rdf+xml + application/rss+xml + application/xhtml+xml + application/xml + font/eot + font/otf + font/ttf + image/svg+xml + text/css + text/javascript + text/plain + text/xml; + + error_page 404 /; + } +} \ No newline at end of file diff --git a/docker-compose.K8S.yaml b/docker-compose.K8S.yaml new file mode 100644 index 0000000..e4a8375 --- /dev/null +++ b/docker-compose.K8S.yaml @@ -0,0 +1,14 @@ +version: "3.3" + +services: + client: + image: crates-client + build: + context: ./client + dockerfile: ./client.Dockerfile + + api: + image: crates-api + build: + context: ./api + dockerfile: ./api.Dockerfile