From 646836493f0f3343a929fcd9f0d9d28217ed9f9a Mon Sep 17 00:00:00 2001 From: Runar Ingebrigtsen Date: Fri, 6 Feb 2026 02:25:54 +0100 Subject: [PATCH] prepare deploy --- .dockerignore | 7 +++++++ .kamal/secrets | 8 ++++++++ Caddyfile | 8 ++++++++ Dockerfile | 14 ++++++++++++++ config/deploy.yml | 27 +++++++++++++++++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 .dockerignore create mode 100644 .kamal/secrets create mode 100644 Caddyfile create mode 100644 Dockerfile create mode 100644 config/deploy.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4a81827 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules +dist +android +ios +.git +.DS_Store +*.log diff --git a/.kamal/secrets b/.kamal/secrets new file mode 100644 index 0000000..36aaa07 --- /dev/null +++ b/.kamal/secrets @@ -0,0 +1,8 @@ +# Secrets for Sanasto Wiki deployment +# DO NOT COMMIT SECRETS TO GIT! This file should read from environment or secure storage. + +# Registry password (GitHub Container Registry token or Docker Hub password) +KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD + +# Rails master key for credentials +RAILS_MASTER_KEY=$(cat config/master.key) diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..c183b71 --- /dev/null +++ b/Caddyfile @@ -0,0 +1,8 @@ +:80 { + root * /usr/share/caddy + file_server + try_files {path} /index.html + + @assets path /assets/* + header @assets Cache-Control "public, max-age=31536000, immutable" +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..740f2cd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM node:20-alpine AS build + +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci +COPY . . +RUN npm run build + +FROM caddy:2.8-alpine + +COPY --from=build /app/dist /usr/share/caddy +COPY ./Caddyfile /etc/caddy/Caddyfile + +EXPOSE 80 diff --git a/config/deploy.yml b/config/deploy.yml new file mode 100644 index 0000000..d9d4f74 --- /dev/null +++ b/config/deploy.yml @@ -0,0 +1,27 @@ +# Name of your application. Used to uniquely configure containers. +service: sanasto-app + +# Name of the container image. +image: soverein/sanasto-app + +# Deploy to these servers. +servers: + web: + - app.rin.no + +# Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server. +proxy: + ssl: true + host: sanasto.app + app_port: 80 + +# Credentials for your image host. +registry: + server: git.rin.no + username: deploybot + password: + - KAMAL_REGISTRY_PASSWORD + +# Configure builder setup. +builder: + arch: amd64