1
0
Fork 0

dockerize, deployable, update package for git.gay

This commit is contained in:
Ava Gaiety W 2024-03-04 18:04:11 +00:00
parent 7e7fe6d9e7
commit 72755d1b17
4 changed files with 60 additions and 11 deletions

16
Dockerfile Normal file
View file

@ -0,0 +1,16 @@
# build with nodejs
FROM node:16.17.0-bullseye-slim AS build
ENV NODE_ENV production
WORKDIR /app
COPY . /app
RUN mkdir -p dist node_modules
RUN chown -R node:node .
USER node
RUN NODE_ENV=development npm ci
RUN npm run build
# serve compiled files with local nginx config
FROM nginx:alpine
WORKDIR /app
COPY --from=build /app/dist .
COPY ./nginx.conf /etc/nginx/nginx.conf

12
docker-compose.yml Normal file
View file

@ -0,0 +1,12 @@
version: "3.9"
services:
app:
container_name: nginx-gaiety-life
image: nginx-gaiety-life
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- "9998:8080"

22
nginx.conf Normal file
View file

@ -0,0 +1,22 @@
events {
worker_connections 1024;
}
http {
include mime.types;
sendfile on;
server {
listen 8080;
listen [::]:8080;
resolver 127.0.0.11;
autoindex on;
server_name _;
server_tokens off;
root /app;
gzip_static on;
}
}

View file

@ -2,29 +2,28 @@
"name": "gaiety-life", "name": "gaiety-life",
"version": "2.0.0", "version": "2.0.0",
"description": "Gaiety's Blog", "description": "Gaiety's Blog",
"main": "index.js",
"scripts": { "scripts": {
"build:styles": "tailwindcss -i ./styles/main.css -o ./_site/main.css", "build": "eleventy",
"build:site": "eleventy", "postbuild": "tailwindcss -i ./styles/main.css -o ./_site/main.css",
"build": "npm run build:site & npm run build:styles", "serve:styles": "tailwindcss -i ./styles/main.css -o ./_site/main.css --watch",
"serve:styles": "npm run build:styles -- --watch", "serve:site": "eleventy --serve",
"serve:site": "npm run build:site -- --serve",
"serve": "concurrently \"npm run serve:site\" \"npm run serve:styles\"", "serve": "concurrently \"npm run serve:site\" \"npm run serve:styles\"",
"start": "npm run serve" "start": "npm run serve",
"deploy": "docker compose up --build -d"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+ssh://git@gitlab.com/gaiety/gaiety-life.git" "url": "git+git@git.gay:gaiety/gaiety-life.git"
}, },
"keywords": [ "keywords": [
"blog" "blog"
], ],
"author": "Ava Gaiety W.", "author": "Ava Gaiety W. <ava@wroten.me> (https://www.gaiety.me/)",
"license": "The Unlicense", "license": "The Unlicense",
"bugs": { "bugs": {
"url": "https://gitlab.com/gaiety/gaiety-life/issues" "url": "https://git.gay/gaiety/gaiety-life/issues"
}, },
"homepage": "https://gitlab.com/gaiety/gaiety-life#readme", "homepage": "https://git.gay/gaiety/gaiety-life/src/branch/main/README.md",
"devDependencies": { "devDependencies": {
"@11ty/eleventy": "^2.0.1", "@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-plugin-rss": "^1.1.2", "@11ty/eleventy-plugin-rss": "^1.1.2",