Compare commits
2 commits
58ebf72d9a
...
0c2e34bb61
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c2e34bb61 | ||
|
|
e4ee90d7cd |
4 changed files with 50 additions and 14 deletions
21
.forgejo/workflows/deploy.yml
Normal file
21
.forgejo/workflows/deploy.yml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
name: Deploy SvelteKit
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: self-hosted
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Deploy with Docker
|
||||
run: |
|
||||
docker compose down
|
||||
docker compose build
|
||||
docker compose up -d
|
||||
|
||||
25
Dockerfile
25
Dockerfile
|
|
@ -1,19 +1,28 @@
|
|||
# Use a Node.js Alpine image for the builder stage
|
||||
# Builder stage
|
||||
FROM node:22-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
|
||||
# Install deps for build
|
||||
COPY package*.json .
|
||||
RUN npm ci
|
||||
|
||||
# Copy source and build
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
RUN npm prune --production
|
||||
|
||||
# Use another Node.js Alpine image for the final stage
|
||||
|
||||
# Final image
|
||||
FROM node:22-alpine
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/build build/
|
||||
COPY --from=builder /app/node_modules node_modules/
|
||||
COPY package.json .
|
||||
|
||||
# Copy only what's needed for runtime
|
||||
COPY package.json ./
|
||||
COPY --from=builder /app/build ./build/
|
||||
COPY --from=builder /app/node_modules ./node_modules/
|
||||
|
||||
# Prune dev dependencies
|
||||
RUN npm prune --production
|
||||
|
||||
EXPOSE 3000
|
||||
ENV NODE_ENV=production
|
||||
CMD ["node", "build"]
|
||||
|
||||
|
|
|
|||
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
version: "3.8"
|
||||
|
||||
services:
|
||||
client:
|
||||
build: .
|
||||
container_name: client
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
|
|
@ -1,8 +1,3 @@
|
|||
<script module>
|
||||
/* Types */
|
||||
type t = string;
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import Article from '$lib/components/Article.svelte';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue