diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..76bad3b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,38 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ +public/sitemap.xml +.vercel + +# production +/build +*.xml +# rss feed +/public/feed.xml + +# misc +.DS_Store + +# debug +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env.local +.env.development.local +.env.test.local +.env.production.local + +secrets.txt \ No newline at end of file diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..c1150e0 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,141 @@ +--- +kind: pipeline +name: base +type: docker + +steps: + - name: install + image: plugins/docker + settings: + registry: docker-registry.ivanli.cc + username: + from_secret: ivan-docker-username + password: + from_secret: ivan-docker-password + repo: docker-registry.ivanli.cc/ivan/gatsby-blog + cache_from: + - docker-registry.ivanli.cc/ivan/gatsby-blog:${DRONE_BRANCH}${DRONE_TAG}-amd64 + dockerfile: Dockerfile + build_args: + - BUILDKIT_INLINE_CACHE=1 + target: base + tags: + - '${DRONE_COMMIT_SHA:0:8}-amd64' + - '${DRONE_BRANCH}${DRONE_TAG}-amd64' + +--- +kind: pipeline +name: linux-amd64 +type: docker +depends_on: + - base + +steps: + - name: build&publish + image: plugins/docker + settings: + registry: docker-registry.ivanli.cc + username: + from_secret: ivan-docker-username + password: + from_secret: ivan-docker-password + repo: docker-registry.ivanli.cc/ivan/gatsby-blog + dockerfile: Dockerfile + target: release + cache_from: + - docker-registry.ivanli.cc/ivan/gatsby-blog:${DRONE_COMMIT_SHA:0:8}-amd64 + tags: + - '${DRONE_COMMIT_SHA:0:8}' + - '${DRONE_BRANCH}${DRONE_TAG}' + - name: notify + image: appleboy/drone-telegram + failure: ignore + when: + status: + - success + - failure + environment: + PLUGIN_TOKEN: + from_secret: drone-telegram-bot-token + PLUGIN_TO: + from_secret: telegram-notify-to + settings: + format: markdown + message: > + {{#success build.status}} + ✅ Build #{{build.number}} of `{{repo.name}}` succeeded. + 📝 Commit by {{commit.author}} on `{{commit.branch}}`: + ``` + {{commit.message}} + ``` + 🌐 {{ build.link }} + {{else}} + ❌ Build #{{build.number}} of `{{repo.name}}` failed. + 📝 Commit by {{commit.author}} on `{{commit.branch}}`: + ``` + {{commit.message}} + ``` + 🌐 {{ build.link }} + {{/success}} + +trigger: + branch: + - master + - main + - develop + +--- +kind: pipeline +type: docker +name: deploy +clone: + disable: true +depends_on: + - linux-amd64 + +steps: + - name: deploy + image: plugins/webhook + settings: + token_value: + from_secret: watchtower-webhook-token + token_type: Bearer + urls: https://watchtower.ivanli.cc/v1/update + content_type: application/json + template: | + { + "owner": "{{ repo.owner }}", + "repo": "{{ repo.name }}", + "status": "{{ build.status }}", + } + + - name: notify + image: appleboy/drone-telegram + when: + status: + - success + - failure + failure: ignore + environment: + PLUGIN_TOKEN: + from_secret: drone-telegram-bot-token + PLUGIN_TO: + from_secret: telegram-notify-to + settings: + format: markdown + message: > + {{#success build.status}} + ✅ Deploy #{{build.number}} of `{{repo.name}}` succeeded. + 📝 Commit by {{commit.author}} on `{{commit.branch}}`: + ``` + {{commit.message}} + ``` + 🌐 {{ build.link }} + {{else}} + ❌ Deploy #{{build.number}} of `{{repo.name}}` failed. + 📝 Commit by {{commit.author}} on `{{commit.branch}}`: + ``` + {{commit.message}} + ``` + 🌐 {{ build.link }} + {{/success}} diff --git a/.gitignore b/.gitignore index 225ed9c..76bad3b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ public/sitemap.xml /build *.xml # rss feed -/public/feed.xml +/public/feed.xml # misc .DS_Store @@ -33,4 +33,6 @@ yarn-error.log* .env.local .env.development.local .env.test.local -.env.production.local \ No newline at end of file +.env.production.local + +secrets.txt \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1ab5abd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:16-alpine as base +WORKDIR /app +COPY package-lock.json package.json ./ +RUN npm ci --no-audit +COPY . . + +FROM node:16-alpine as release +WORKDIR /app +COPY --from=base /app ./ +RUN npm run build &&\ + npm prune --omit dev +EXPOSE 80 +CMD npm run serve -- --port 80 \ No newline at end of file diff --git a/data/authors/default.md b/data/authors/default.md index c518f0a..be7823a 100644 --- a/data/authors/default.md +++ b/data/authors/default.md @@ -1,16 +1,16 @@ --- -name: Tails Azimuth -avatar: /static/images/avatar.png -occupation: Professor of Atmospheric Science -company: Stanford University -email: address@yoursite.com -twitter: https://twitter.com/Twitter -linkedin: https://www.linkedin.com -github: https://github.com +name: Ivan Li +avatar: https://pan.ivanli.cc/api/v3/file/source/1234/%E5%A4%B4%E5%83%8F.png?sign=xIgy54DyFRYupxjZJbK02HmpKX8C53YR-O0I18Rxm70%3D%3A0 +occupation: Web Full Stack Developer +email: master@ivanli.cc +github: https://github.com/IvanLi-CN --- -Tails Azimuth is a professor of atmospheric sciences at the Stanford AI Lab. His research interests includes complexity modelling of tailwinds, headwinds and crosswinds. +你好呀! -He leads the clean energy group which develops 3D air pollution-climate models, writes differential equation solvers, and manufactures titanium plated air ballons. In his free time he bakes raspberry pi. +我是 Ivan Li,从事 Web 全栈开发工作,最近在研究电子电路与嵌入式开发。这是我的博客,用来与到访的你分享我的繁星点点。 -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate. +我平常做 Web 开发一般会使用 **React**、**Angular**、**Vue**、**NestJS** 相关生态,我偏好 PostgreSQL 存储数据。我喜欢 MacOS 和 ArchLinux。 +我正在学习 Rust 语言,它非常棒,我在用 **Rust** 和 **ESP32-C3** 实现一些嵌入式的工程。我还在慢慢摸索电子电路知识,希望我能平安地学到足够用的知识。 + +哦,对了!因为平常使用 [Logseq](https://notes.ivanli.cc/) 做记录,它相当于我的扩展记忆体,我的很多公开内容都在那儿。不过最后我会找个时间,将内容梳理过来,请放心。 diff --git a/data/projectsData.js b/data/projectsData.js index 958f676..1692be3 100644 --- a/data/projectsData.js +++ b/data/projectsData.js @@ -1,20 +1,20 @@ const projectsData = [ - { - title: 'A Search Engine', - description: `What if you could look up any information in the world? Webpages, images, videos - and more. Google has many features to help you find exactly what you're looking - for.`, - imgSrc: '/static/images/google.png', - href: 'https://www.google.com', - }, - { - title: 'The Time Machine', - description: `Imagine being able to travel back in time or to the future. Simple turn the knob - to the desired date and press "Go". No more worrying about lost keys or - forgotten headphones with this simple yet affordable solution.`, - imgSrc: '/static/images/time-machine.jpg', - href: '/blog/the-time-machine', - }, + // { + // title: 'A Search Engine', + // description: `What if you could look up any information in the world? Webpages, images, videos + // and more. Google has many features to help you find exactly what you're looking + // for.`, + // imgSrc: '/static/images/google.png', + // href: 'https://www.google.com', + // }, + // { + // title: 'The Time Machine', + // description: `Imagine being able to travel back in time or to the future. Simple turn the knob + // to the desired date and press "Go". No more worrying about lost keys or + // forgotten headphones with this simple yet affordable solution.`, + // imgSrc: '/static/images/time-machine.jpg', + // href: '/blog/the-time-machine', + // }, ] export default projectsData diff --git a/data/siteMetadata.js b/data/siteMetadata.js index 0b42cb0..4c09766 100644 --- a/data/siteMetadata.js +++ b/data/siteMetadata.js @@ -1,22 +1,25 @@ const siteMetadata = { - title: 'Next.js Starter Blog', - author: 'Tails Azimuth', - headerTitle: 'TailwindBlog', - description: 'A blog created with Next.js and Tailwind.css', - language: 'en-us', + title: 'Ivan‘s Blog', + author: 'Ivan Li', + headerTitle: 'Ivan‘s Blog', + description: + '一个 Web 全栈开发者、嵌入式开发爱好者,与你分享我的工作和生活。专注 React、Node.js、Rust,热爱 Self-Hosted、IoT、硬件。', + language: 'zh-CN', theme: 'system', // system, dark or light - siteUrl: 'https://tailwind-nextjs-starter-blog.vercel.app', - siteRepo: 'https://github.com/timlrx/tailwind-nextjs-starter-blog', - siteLogo: '/static/images/logo.png', - image: '/static/images/avatar.png', + siteUrl: 'https://ivanli.cc/', + siteRepo: 'https://git.ivanli.cc/ivan/taliwind-nextjs-blog', + siteLogo: + 'https://pan.ivanli.cc/api/v3/file/source/1234/%E5%A4%B4%E5%83%8F.png?sign=xIgy54DyFRYupxjZJbK02HmpKX8C53YR-O0I18Rxm70%3D%3A0', + image: + 'https://pan.ivanli.cc/api/v3/file/source/1234/%E5%A4%B4%E5%83%8F.png?sign=xIgy54DyFRYupxjZJbK02HmpKX8C53YR-O0I18Rxm70%3D%3A0', socialBanner: '/static/images/twitter-card.png', - email: 'address@yoursite.com', - github: 'https://github.com', - twitter: 'https://twitter.com/Twitter', - facebook: 'https://facebook.com', - youtube: 'https://youtube.com', - linkedin: 'https://www.linkedin.com', - locale: 'en-US', + email: 'master@ivanli.cc', + github: 'https://github.com/IvanLi-CN', + // twitter: 'https://twitter.com/Twitter', + // facebook: 'https://facebook.com', + // youtube: 'https://youtube.com', + // linkedin: 'https://www.linkedin.com', + locale: 'zh-CN', analytics: { // If you want to use an analytics provider you have to add it to the // content security policy in the `next.config.js` file. diff --git a/next.config.js b/next.config.js index 1d65aa8..0fc93c0 100644 --- a/next.config.js +++ b/next.config.js @@ -58,6 +58,9 @@ module.exports = withBundleAnalyzer({ eslint: { dirs: ['pages', 'components', 'lib', 'layouts', 'scripts'], }, + images: { + domains: ['pan.ivanli.cc'], + }, async headers() { return [ { diff --git a/package-lock.json b/package-lock.json index b96d2b2..5c0c553 100644 Binary files a/package-lock.json and b/package-lock.json differ diff --git a/package.json b/package.json index 7eaf349..9272cff 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "tailwind-nextjs-starter-blog", + "name": "tailwind-nextjs-blog", "version": "1.5.6", "private": true, "scripts": { diff --git a/pages/404.js b/pages/404.js index 4e00d4f..2a26ba3 100644 --- a/pages/404.js +++ b/pages/404.js @@ -17,7 +17,7 @@ export default function FourZeroFour() { Sorry we couldn't find this page.
- But dont worry, you can find plenty of other things on our homepage. + But don't worry, you can find plenty of other things on our homepage.