Skip to content

Commit e3ccbe2

Browse files
committed
Update deploy scripts
1 parent 16ac273 commit e3ccbe2

9 files changed

Lines changed: 2324 additions & 1917 deletions

File tree

.dockerignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/.git
2+
/.github
3+
.gitignore
4+
.dockerignore
5+
Makefile
6+
compose*.yaml
7+
README.md
8+
/node_modules
9+
/build
10+
/.docusaurus
11+
yarn-debug.log*
12+
yarn-error.log*

.github/workflows/deploy.yaml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,16 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout code
12-
uses: actions/checkout@v4
13-
14-
- name: Build
15-
run: |
16-
yarn install
17-
yarn build
12+
uses: actions/checkout@v6
1813

1914
- name: Upload files
20-
uses: easingthemes/ssh-deploy@v2
21-
env:
15+
uses: easingthemes/ssh-deploy@v5.1.0
16+
with:
2217
SSH_PRIVATE_KEY: ${{ secrets.REMOTE_SSH_KEY }}
2318
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
2419
REMOTE_USER: ${{ secrets.REMOTE_USER }}
2520
REMOTE_PORT: ${{ secrets.REMOTE_PORT }}
2621
TARGET: ${{ secrets.REMOTE_TARGET }}
27-
SOURCE: build/
28-
ARGS: "-rtzv --delete"
22+
ARGS: "-rzv --delete --exclude='.git/' --exclude='.github/'"
23+
SCRIPT_AFTER: |
24+
sudo docker compose -f ${{ secrets.REMOTE_TARGET }}/compose.yaml up -d --build

.gitignore

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
1-
# Dependencies
21
/node_modules
3-
4-
# Production
52
/build
6-
7-
# Generated files
8-
.docusaurus
9-
.cache-loader
10-
11-
# Misc
12-
.DS_Store
13-
.env.local
14-
.env.development.local
15-
.env.test.local
16-
.env.production.local
17-
18-
npm-debug.log*
3+
/.docusaurus
194
yarn-debug.log*
205
yarn-error.log*

Makefile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,20 @@ help: ## Show this help
77
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z1-9_\-\/\.]+:.*?## / {printf " \033[32m%-24s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
88

99
node_modules:
10-
@docker run -it --rm --user=${USER_ID}:${GROUP_ID} -v ./:/app/ -w /app/ node:23 bash -c "yarn install"
10+
@docker run -it --rm --user=${USER_ID}:${GROUP_ID} -v ./:/app/ -w /app/ node:25 bash -c "yarn install"
1111

12-
.PHONY: start
13-
start: node_modules ## Yarn start
14-
@docker run -p 3000:3000 -it --rm --user=${USER_ID}:${GROUP_ID} -v ./:/app/ -w /app/ node:23 bash -c "yarn start -h 0.0.0.0"
12+
.PHONY: dev
13+
dev: node_modules ## Start in dev mode
14+
@docker run -p 3000:3000 -it --rm --user=${USER_ID}:${GROUP_ID} -v ./:/app/ -w /app/ node:25 bash -c "yarn start -h 0.0.0.0"
15+
@echo "➡️ Serve: http://127.0.0.1:3000/"
1516

1617
.PHONY: upgrade
1718
upgrade: node_modules ## Yarn upgrade
18-
@docker run -it --rm --user=${USER_ID}:${GROUP_ID} -v ./:/app/ -w /app/ node:23 bash -c "yarn upgrade"
19-
20-
.PHONY: build
21-
build: node_modules ## Yarn build
22-
@docker run -it --rm --user=${USER_ID}:${GROUP_ID} -v ./:/app/ -w /app/ node:23 bash -c "yarn build"
19+
@docker run -it --rm --user=${USER_ID}:${GROUP_ID} -v ./:/app/ -w /app/ node:25 bash -c "yarn upgrade"
2320

2421
.PHONY: bash
2522
bash: node_modules ## Go to bash console
26-
@docker run -it --rm --user=${USER_ID}:${GROUP_ID} -v ./:/app/ -w /app/ node:23 bash
23+
@docker run -it --rm --user=${USER_ID}:${GROUP_ID} -v ./:/app/ -w /app/ node:25 bash
2724

2825
.PHONY: clean
2926
clean: ## Remove files

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ PHPStreamServer documentation website [phpstreamserver.dev](https://phpstreamser
55
### Local Development
66

77
```
8-
$ make start
8+
$ make dev
99
```
10+
Serve: http://127.0.0.1:3000
1011

11-
### Build
12+
### Production Run
1213

1314
```
14-
$ make build
15+
$ docker compose up -d --build
1516
```
17+
Serve: http://127.0.0.1:9080

compose.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
app:
3+
build:
4+
context: ./
5+
dockerfile: ./docker/Dockerfile
6+
restart: unless-stopped
7+
ports:
8+
- "9080:80"

docker/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM node:25-alpine AS node
2+
COPY ./ /app/
3+
WORKDIR /app/
4+
5+
RUN yarn install && yarn build
6+
7+
FROM nginx:1.29
8+
9+
RUN rm -rf /etc/nginx/conf.d/*
10+
COPY --chown=root:root ./docker/app.conf /etc/nginx/conf.d/
11+
COPY --from=node --chown=nginx:nginx /app/build/ /var/www/public/
12+
RUN chmod -R a+rX /var/www/public/
13+
14+
CMD ["nginx", "-g", "daemon off;"]

docker/app.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
server {
2+
listen 80 default_server;
3+
access_log off;
4+
charset utf-8;
5+
root /var/www/public;
6+
error_page 404 /404.html;
7+
}

0 commit comments

Comments
 (0)