From 18472ac6b0a15bd6fa9f64ab7c8fb0a7e9df1a68 Mon Sep 17 00:00:00 2001 From: Neeldhara Misra Date: Sat, 13 Jun 2026 23:37:16 +0200 Subject: [PATCH] Add Dokploy Docker deployment --- .dockerignore | 11 +++++++++++ .gitignore | 1 + Dockerfile | 19 +++++++++++++++++++ deploy/nginx.conf | 24 ++++++++++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 deploy/nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c70d11d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +node_modules +dist +.astro +.git +.DS_Store +.env +.env.production +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* diff --git a/.gitignore b/.gitignore index f03331d..b1225d4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ dist/ # dependencies node_modules/ +.npm-cache/ # logs npm-debug.log* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..05dca2b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:22-alpine AS build + +WORKDIR /app + +COPY package.json package-lock.json ./ +RUN npm ci + +COPY . . +RUN npm run build + +FROM nginx:1.27-alpine AS runtime + +COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/dist /usr/share/nginx/html + +EXPOSE 80 + +HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \ + CMD wget -q --spider http://127.0.0.1/nginx-health || exit 1 diff --git a/deploy/nginx.conf b/deploy/nginx.conf new file mode 100644 index 0000000..b32f98d --- /dev/null +++ b/deploy/nginx.conf @@ -0,0 +1,24 @@ +server { + listen 80 default_server; + server_name micro.neeldhara.blog micro.neeldhara.email _; + root /usr/share/nginx/html; + index index.html; + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log warn; + + location = /nginx-health { + access_log off; + return 204; + } + + location ~* \.(?:css|js|mjs|png|jpg|jpeg|gif|svg|webp|ico|woff2?)$ { + try_files $uri =404; + expires 1y; + add_header Cache-Control "public, immutable"; + } + + location / { + try_files $uri $uri/index.html /index.html /404.html; + } +}