Skip to content

Commit 2eda3f4

Browse files
committed
modified docker configs to streamline deplpoyment process
1 parent 199235f commit 2eda3f4

File tree

5 files changed

+33
-16
lines changed

5 files changed

+33
-16
lines changed

.github/workflows/build-and-deploy.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ jobs:
4242
key: ${{ secrets.SSH_KEY }}
4343
port: ${{ secrets.SSH_PORT }}
4444
passphrase: ${{ secrets.SSH_PASSPHRASE }}
45-
source: "./.output,./src,./public,./mdx,./*"
45+
source: "./.output,./src,./public,./mdx,./package.json,./package-lock.json,./nginx"
4646
target: "~/sourcedepth.com/"
4747
overwrite: true
48+
- name: Build and restart Docker containers
49+
uses: appleboy/ssh-action@v1
50+
with:
51+
host: ${{ secrets.SSH_HOST }}
52+
username: ${{ secrets.SSH_USERNAME }}
53+
key: ${{ secrets.SSH_KEY }}
54+
port: ${{ secrets.SSH_PORT }}
55+
passphrase: ${{ secrets.SSH_PASSPHRASE }}
56+
script: |
57+
cd ~/sourcedepth.com
58+
docker-compose down
59+
docker-compose build --pull --no-cache
60+
docker-compose up -d
61+
docker system prune -f

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ sketch
4545
.nitro
4646
.tanstack
4747
_old*
48-
.vscode
48+
.vscode
49+
certbot/

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ ARG NODE_VERSION=22.13.1
44

55
FROM node:${NODE_VERSION}-alpine as base
66
WORKDIR /usr/src/app
7-
EXPOSE 3000
87

98
FROM base as prod
9+
COPY package.json .
10+
COPY package-lock.json .
11+
RUN npm ci --omit=dev
12+
EXPOSE 3000
13+
1014
USER node
11-
COPY . .
15+
COPY ./public ./public
16+
COPY ./mdx ./mdx
17+
COPY ./.output ./.output
1218
CMD node .output/server/index.mjs

docker-compose.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ services:
55
ports:
66
- 3000:3000
77
environment:
8-
NODE_ENV: production
8+
NODE_ENV: production
99
volumes:
10-
- ./.output:/usr/src/app/.output
1110
- ./mdx:/usr/src/app/mdx
1211
- ./public:/usr/src/app/public
12+
- ./.output:/usr/src/app/.output
13+
- ./package.json:/usr/src/app/package.json
14+
- ./package-lock.json:/usr/src/app/package-lock.json
1315
nginx:
1416
depends_on:
1517
- server
16-
build:
17-
./nginx
18+
image: nginx:latest
1819
volumes:
19-
- ./nginx/conf/:/etc/nginx/conf.d/:ro
20+
- ./nginx/nginx.conf:/etc/nginx/conf.d/nginx.conf:ro
2021
- ./certbot/www/:/var/www/certbot/:ro
2122
- ./certbot/conf/:/etc/nginx/ssl/:ro
2223
ports:
@@ -27,6 +28,5 @@ services:
2728
image: certbot/certbot:latest
2829
volumes:
2930
- ./certbot/www/:/var/www/certbot/:rw
30-
- ../web/certbot/conf/:/etc/letsencrypt/:rw
31-
command: certonly --webroot -w /var/www/certbot/ --email [email protected] -d sourcedepth.com --agree-tos --keep-until-expiring
32-
restart: always
31+
- ./certbot/conf/:/etc/letsencrypt/:rw
32+
command: certonly --webroot -w /var/www/certbot/ --email [email protected] -d sourcedepth.com --agree-tos --keep-until-expiring

nginx/Dockerfile

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)