Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature public url #292

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VUE_APP_PUBLIC_PATH = '/'
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VUE_APP_PUBLIC_PATH = './'
28 changes: 28 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build Docker Image

on:
push:
branches:
- main # 当推送到 main 分支时触发
pull_request:
branches:
- main # 当有 pull request 到 main 分支时触发

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ../../docker/Dockerfile
push: false # 不推送镜像
tags: weektodo-product:latest
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ pnpm-debug.log*
#Electron-builder output
/dist_electron

.env
# docker
compose.yml
Dockerfile
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,16 @@ yarn run electron:serve // to run native version
```

### Docker

To run the development web version use `docker-compose up`

get into the `docker` folder, if you want run the development web version copy the file with prefix "devlop." and delete the prefix then run the command: `docker-compose up`, production version also.
use command `docker build -t weektodo:latest -f docker/Dockerfile .` to build the image.
### Reverse Proxy
use Caddy to reverse proxy the app, you can use edit Caddyfile. for example:
```
:80/weektodo/* {
uri strip_prefix /weektodo
reverse_proxy http://weektodo:80
}
```
## Contributing

You can support this project in several ways:
Expand Down
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions docker/product.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frist prase
FROM node:16-alpine AS builder
WORKDIR /app
COPY package.json yarn.lock /app/
RUN yarn install --frozen-lockfile && yarn cache clean
# because dcoker is layer build and every layer docker when builded will has cache,so we can use cache to speed up the build
COPY . /app
RUN ["yarn", "run", "build"]
# second prase
FROM caddy:latest
WORKDIR /app
COPY --from=builder /app/dist /usr/share/caddy/
EXPOSE 80
15 changes: 15 additions & 0 deletions docker/product.compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
weektodo:
build:
context: ..
dockerfile: docker/Dockerfile
container_name: weektodo
restart: unless-stopped
ports:
- "8080:80"
healthcheck:
test: ["CMD", "wget", "--spider", "http://127.0.0.1:80"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
4 changes: 2 additions & 2 deletions src/components/layout/sideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="side-bar">
<img
class="logo"
src="/img/logo-color.svg"
src="img/logo-color.svg"
width="42"
height="42"
alt="WeekTodo Logo"
Expand All @@ -12,7 +12,7 @@
/>
<img
class="logo logo-white"
src="/img/logo-white.svg"
src="img/logo-white.svg"
width="42"
height="42"
alt="WeekTodo Logo"
Expand Down
4 changes: 2 additions & 2 deletions src/views/aboutModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
<div class="d-flex flex-column" style="text-align: center; margin-top: 10px">
<img
class="logo align-self-center"
src="/img/weektodo-isologo-color.svg"
src="img/weektodo-isologo-color.svg"
alt="WeekToDo"
title="WeekToDo Logo"
width="256"
/>
<img
class="logo logo-white align-self-center"
src="/img/weektodo-isologo-white.svg"
src="img/weektodo-isologo-white.svg"
alt="WeekToDo"
title="WeekToDo Logo"
width="256"
Expand Down
1 change: 1 addition & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
publicPath: process.env.VUE_APP_PUBLIC_PATH,
pluginOptions: {
electronBuilder: {
nodeIntegration: true,
Expand Down
Loading