Docker and Docker compose
All checks were successful
Build and deploy website / build (push) Successful in 3m26s

Updated dependencies

Updated workflow to use docker compose

Signed-off-by: Martin Berg Alstad <git@martials.no>
This commit is contained in:
Martin Berg Alstad 2024-10-12 19:07:55 +02:00
parent 740cba625d
commit b8e77b2a54
Signed by: martials
GPG Key ID: DF629A90917D1319
7 changed files with 753 additions and 661 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
.astro
.gitea
.DS_Store
node_modules
dist

View File

@ -1,41 +0,0 @@
name: Build and deploy website
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install dependencies
run: echo y | npm exec -- pnpm install
- name: Build
run: npm exec -- pnpm build
- name: Upload artifacts
uses: actions/upload-artifact@v3 # Deprecated and v4+ is not supported for GHES
with:
name: dist
path: dist
# TODO update deploy to work with node
deploy:
runs-on: host
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Move files to server
run: |
rm -rf /var/www/beta.martials.no/*
cp -r dist/* /var/www/beta.martials.no

View File

@ -0,0 +1,19 @@
name: Build and deploy website
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: host
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Run docker-compose
run: docker compose up -d --build

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM node:lts-alpine AS base
WORKDIR /app
# By copying only the package.json and package-lock.json here, we ensure that the following `-deps` steps are independent of the source code.
# Therefore, the `-deps` steps will be skipped if only the source code changes.
COPY package.json pnpm-lock.yaml ./
COPY project.inlang ./project.inlang
FROM base AS prod-deps
RUN echo y | npm exec -- pnpm install --prod
FROM base AS build-deps
RUN npm exec -- pnpm install
FROM build-deps AS build
COPY . .
RUN npm exec -- pnpm run build
FROM base AS runtime
COPY --from=prod-deps /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
ENV HOST=0.0.0.0
ENV PORT=4321
EXPOSE 4321
CMD node ./dist/server/entry.mjs

8
docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
services:
web:
restart: always
build:
context: .
dockerfile: Dockerfile
ports:
- "4321:4321"

View File

@ -13,25 +13,25 @@
"watch-messages": "paraglide-js compile --watch --project ./project.inlang --outdir ./src/paraglide"
},
"dependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/mdx": "^3.1.7",
"@astrojs/check": "^0.9.4",
"@astrojs/mdx": "^3.1.8",
"@astrojs/node": "^8.3.4",
"@astrojs/sitemap": "^3.1.6",
"@astrojs/svelte": "^5.7.1",
"@astrojs/tailwind": "^5.1.1",
"@iconify-json/pajamas": "^1.2.2",
"@astrojs/sitemap": "^3.2.0",
"@astrojs/svelte": "^5.7.2",
"@astrojs/tailwind": "^5.1.2",
"@iconify-json/pajamas": "^1.2.3",
"@inlang/paraglide-astro": "^0.2.2",
"@inlang/paraglide-js": "1.11.2",
"@tailwindcss/typography": "^0.5.15",
"astro": "^4.15.9",
"astro": "^4.16.2",
"astro-icon": "^1.1.1",
"sharp": "^0.33.5",
"svelte": "^4.2.19",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.2"
"typescript": "^5.6.3"
},
"devDependencies": {
"@inlang/paraglide-js": "1.11.2",
"daisyui": "^4.12.10",
"daisyui": "^4.12.13",
"prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-svelte": "^3.2.7",

1295
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff