From 1feab842b3a26b621ad6fa954e9001d80307c439 Mon Sep 17 00:00:00 2001 From: arch-fan Date: Wed, 9 Oct 2024 10:25:53 +0200 Subject: [PATCH 1/5] Ignored common files --- .dockerignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b21dcf6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +dist/ +node_modules/ +.vscode/ +.github/ From 3434464aa08f32f3b041f2edd31153cfe65e5b76 Mon Sep 17 00:00:00 2001 From: arch-fan Date: Wed, 9 Oct 2024 10:26:03 +0200 Subject: [PATCH 2/5] Build implementation --- Dockerfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..25879d3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM node:lts AS base +WORKDIR /app + +FROM base AS deps +COPY package*.json . +RUN npm install + +FROM base AS build +COPY --from=deps /app/node_modules ./node_modules +COPY . . +RUN npm run build + +FROM nginx:stable-alpine AS deploy +COPY --from=build /app/dist /usr/share/nginx/html +COPY ./nginx/nginx.conf /etc/nginx/nginx.conf + +EXPOSE 8080 From c1e6fee765d9fc35649aa474d1498b3bf6eec8f1 Mon Sep 17 00:00:00 2001 From: arch-fan Date: Wed, 9 Oct 2024 10:26:17 +0200 Subject: [PATCH 3/5] Deploy implementation --- docker-compose.yml | 6 ++++++ nginx/nginx.conf | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 docker-compose.yml create mode 100644 nginx/nginx.conf diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0d40bc1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +services: + astrowind: + image: . + container_name: astrowind + ports: + - 8080:8080 \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..4de4ee7 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,31 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + server { + listen 8080; + server_name _; + + root /usr/share/nginx/html; + index index.html index.htm; + include /etc/nginx/mime.types; + + gzip on; + gzip_min_length 1000; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + error_page 404 /404.html; + location = /404.html { + root /usr/share/nginx/html; + internal; + } + + location / { + try_files $uri $uri/index.html =404; + } + } +} \ No newline at end of file From f037b71f2bb4b6bbae62aa80a0ae65fd4efc2b0f Mon Sep 17 00:00:00 2001 From: arch-fan Date: Wed, 9 Oct 2024 10:29:39 +0200 Subject: [PATCH 4/5] Image to build --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0d40bc1..476c1b9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: astrowind: - image: . + build: . container_name: astrowind ports: - 8080:8080 \ No newline at end of file From 9a0da09d195a9207f297bf882606f6dd59aeb2fa Mon Sep 17 00:00:00 2001 From: arch-fan Date: Wed, 9 Oct 2024 10:31:07 +0200 Subject: [PATCH 5/5] Missing slash --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 25879d3..25d7456 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM node:lts AS base WORKDIR /app FROM base AS deps -COPY package*.json . +COPY package*.json ./ RUN npm install FROM base AS build