docker deploy steps

This commit is contained in:
Ava Gaiety W 2024-03-08 16:01:00 +00:00
parent 70a982361a
commit 28f496f393
4 changed files with 39 additions and 8 deletions

12
Dockerfile Normal file
View file

@ -0,0 +1,12 @@
# build with nodejs
FROM node:16.17.0-bullseye-slim
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 postinstall
RUN npm run prestart
CMD ["node", "./app.js"]

View file

@ -6,13 +6,13 @@ Inspired by [@morganastra](https://twitter.com/morganastra)'s [pronoun.is](https
- [NodeJS](https://nodejs.org/en/)
```bash
```sh
npm i # Installs Dependencies
```
### Serving Locally
```bash
```sh
npm start
```
@ -21,11 +21,12 @@ npm start
### Deploy
```bash
npm build:css
npm start
```sh
npm run deploy
```
### Testing
TODO
```sh
npm test
```

12
docker-compose.yml Normal file
View file

@ -0,0 +1,12 @@
version: "3.9"
services:
app:
container_name: pronoun-monster
image: pronoun-monster
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- "9995:3000"

View file

@ -5,7 +5,12 @@
"main": "app.js",
"scripts": {
"postinstall": "mkdir -p ./dist",
"start": "concurrently npm:serve:*",
"start": "node app.js",
"prestart": "npm run start:css && npm run start:svg && npm run start:images",
"start:css": "tailwindcss -i ./src/app.css -o ./dist/app.css",
"start:svg": "npm run build:svg",
"start:images": "npm run build:images",
"serve": "concurrently npm:serve:*",
"build": "concurrently npm:build:*",
"serve:handlebars": "node app.js",
"serve:css": "tailwindcss -i ./src/app.css -o ./dist/app.css --watch",
@ -16,7 +21,8 @@
"build:images": "mkdir -p ./dist ./dist/images && cp ./src/images/* ./dist/images/",
"test": "ava",
"lint": "prettier --check .",
"prepare": "husky install"
"prepare": "husky install",
"deploy": "docker compose up --build -d"
},
"repository": {
"type": "git",