Skip to content

Commit

Permalink
Add multiple changes to docs and build system.
Browse files Browse the repository at this point in the history
- Update Docker README with build and push instructions
- Remove Travis CI configuration and add CHANGELOG.md
- Update Docker workflow to use specific action versions and add artifact attestation step
- Enhance Docker CI workflow to inject version and commit ID into index.ejs, manage tags, and streamline versioning process
- Refactor Dockerfile to copy application files directly and remove unnecessary git clone step
  • Loading branch information
joachimmueller committed Dec 29, 2024
1 parent ad26d1e commit 1e33fd2
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 22 deletions.
43 changes: 29 additions & 14 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Docker Image CI

on:
schedule:
- cron: "0 10 * * *"
push:
branches:
- "master"
Expand All @@ -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 "<!-- Version: $VERSION, Commit ID: $COMMIT -->" >> views/index.ejs
grep "<!-- Version: $VERSION, Commit ID: $COMMIT -->" 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 }}
3 changes: 0 additions & 3 deletions .travis.yml

This file was deleted.

76 changes: 76 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
7 changes: 2 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -25,9 +25,6 @@ RUN apk update \

FROM node:lts-alpine

# Your contact info
MAINTAINER J Mueller <[email protected]>

ENV READ2BURN_HOME="/app"

WORKDIR ${READ2BURN_HOME}
Expand Down
19 changes: 19 additions & 0 deletions docker/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,22 @@ Apache config for sub paths
RequestHeader set X-Forwarded-Ssl on
</Location>
---


Build docker

```sh
cd ..
docker build -t wemove/read2burn:latest -f docker/Dockerfile .
```

Push image to a docker registry

```sh
docker login <docker-registry>
docker tag wemove/read2burn:latest <docker-registry or your-dockerhub-username>/read2burn:l<version>
docker push <docker-registry or your-dockerhub-username>/read2burn:<version>
```

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)

0 comments on commit 1e33fd2

Please sign in to comment.