diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c5afe2e..6298f04 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,8 +1,6 @@ name: Docker Image CI on: - schedule: - - cron: "0 10 * * *" push: branches: - "master" @@ -19,38 +17,55 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + + - name: Get the version tag + id: get_version + run: | + TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "no-tag") + echo "version=$TAG" >> $GITHUB_ENV + + - name: Get the commit ID + id: get_commit + run: echo "commit=$(git rev-parse HEAD)" >> $GITHUB_ENV + + - name: Inject version and commit ID into index.ejs + run: | + VERSION=${{ env.version }} + COMMIT=${{ env.commit }} + echo "" >> views/index.ejs + grep "" views/index.ejs || exit 1 + - name: Docker meta id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: # list of Docker images to use as base name for tags images: | wemove/read2burn - # generate Docker tags based on the following events/attributes tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr + type=raw,value=latest type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - type=sha + type=semver,pattern={{major}}.{{minor}} + - name: Set up QEMU uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push - uses: docker/build-push-action@v5 + id: push + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 with: context: . push: ${{ github.event_name != 'pull_request' }} file: docker/Dockerfile tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6e5919d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - "0.10" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4a93f10 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,76 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [v0.7.2] - 2024-12-29 +### Added +- Add CHANGELOG.md. +- Add version and git commit id as HTML tag during docker build process. + +### Changed +- Upate several dependencies. +- Update documentation. + + +## [v0.7.1] - 2024-05-09 +### Added +- Add github action and switch to version scheme `va.b.c`. + +### Changed +- Upate several dependencies. + + +## [0.7.0] - 2023-11-18 +### Added +- Update encryption to aes-256-cbc. +- Remove tracking code. +- Add license file. +- Disable Header "X-Powered-By: Express" for security reason. +- Better parameter validation. + +### Changed +- Upate several dependencies. + + +## [0.6.1] - 2021-03-30 +### Changed +- Fix copying issue with mobile browsers. + +## [0.6.0] - 2021-03-30 +### Added +- Add copy button. + +### Changed +- Updated jquery version. + + +## [0.5.0] - 2021-01-25 +### Changed +- Fix loading database error during migration. +- Solve file cincurrency issue. + + +## [0.4.0] - 2020-11-19 +### Added +- Replace chaos with NeDB, optimize data processing, add migration and update layout. + +## [0.3.0] - 2020-02-03 +### Added +- Initial version. + + + +[Unreleased]: https://github.com/wemove/read2burn/compare/v0.7.2...HEAD +[v0.7.2]: https://github.com/wemove/read2burn/compare/v0.7.1...v0.7.2 +[v0.7.1]: https://github.com/wemove/read2burn/compare/0.7.0...v0.7.1 +[0.7.0]: https://github.com/wemove/read2burn/compare/0.6.1...0.7.0 +[0.6.1]: https://github.com/wemove/read2burn/compare/0.6.0...0.6.1 +[0.6.0]: https://github.com/wemove/read2burn/compare/0.5.0...0.6.0 +[0.5.0]: https://github.com/wemove/read2burn/compare/0.4.0...0.5.0 +[0.4.0]: https://github.com/wemove/read2burn/compare/0.3.0...0.4.0 +[0.3.0]: https://github.com/wemove/read2burn/releases/tag/0.3.0 \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 3a781fb..11ac899 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,6 +7,8 @@ ENV READ2BURN_HOME="/app" WORKDIR ${READ2BURN_HOME} +COPY . . + # Run a command inside the image # If you are building your code for production # RUN npm ci --only=production @@ -15,8 +17,6 @@ WORKDIR ${READ2BURN_HOME} RUN apk update \ && apk upgrade \ && apk add --no-cache tzdata \ - && apk add git \ - && git clone --single-branch --depth 1 https://github.com/wemove/read2burn.git ${READ2BURN_HOME} \ && npm ci --only=production \ && rm -rf ${READ2BURN_HOME}/docker @@ -25,9 +25,6 @@ RUN apk update \ FROM node:lts-alpine -# Your contact info -MAINTAINER J Mueller - ENV READ2BURN_HOME="/app" WORKDIR ${READ2BURN_HOME} diff --git a/docker/readme.md b/docker/readme.md index 387c73e..05a3b8d 100644 --- a/docker/readme.md +++ b/docker/readme.md @@ -16,3 +16,22 @@ Apache config for sub paths RequestHeader set X-Forwarded-Ssl on --- + + +Build docker + +```sh +cd .. +docker build -t wemove/read2burn:latest -f docker/Dockerfile . +``` + +Push image to a docker registry + +```sh +docker login +docker tag wemove/read2burn:latest /read2burn:l +docker push /read2burn: +``` + +The official Docker image is built automatically by a GitHub Action. You can find it on Docker Hub: [wemove/read2burn](https://hub.docker.com/r/wemove/read2burn) +