Update version format for canary.

We are now using the traditional versioning format for canary releases, instead of using the commit hash as the version.
This commit is contained in:
Shahrad Elahi 2024-02-12 13:44:07 +03:30
parent b3b9beddf3
commit ccc3b20132
7 changed files with 26 additions and 14 deletions

View File

@ -5,10 +5,16 @@ on:
inputs:
tag:
description: 'Tag to build'
required: false
required: true
##
# Invoke:
# gh workflow run "Build Prerelease Image" -f tag=2.0.0-canary.0
##
env:
IMAGE_TAG: canary-${{ github.event.inputs.tag || github.sha }}
IMAGE_TAG: ${{ github.event.inputs.tag }}
BUILD_PLATFORMS: linux/amd64,linux/arm64
permissions:
contents: read
@ -38,6 +44,7 @@ jobs:
context: .
file: ./Dockerfile
push: true
args: VERSION=${{ env.IMAGE_TAG }}
tags: ghcr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
@ -64,4 +71,6 @@ jobs:
context: .
file: ./Dockerfile
push: true
platforms: ${{ env.BUILD_PLATFORMS }}
args: VERSION=${{ env.IMAGE_TAG }}
tags: docker.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

View File

@ -82,6 +82,10 @@ RUN mkdir -p /var/vlogs && touch /var/vlogs/web && chmod -R 600 /var/vlogs
# Volumes
VOLUME ["/etc/torrc.d", "/data", "/var/vlogs"]
# Overwrite package version
ARG VERSION=0.0.0-canary
RUN node -e "const fs = require('fs'); const pkg = JSON.parse(fs.readFileSync('/app/package.json')); pkg.version = process.env.VERSION; fs.writeFileSync('/app/package.json', JSON.stringify(pkg, null, 2));"
# Run the app
EXPOSE 3000/tcp
CMD [ "npm", "run", "start" ]

View File

@ -45,17 +45,20 @@ FROM base AS runner
ENV NODE_ENV=development
ENV LOG_LEVEL=debug
ENV VERSION=0.0.0-dev
COPY docker-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# Fix permissions
RUN mkdir -p /data && chmod 700 /data
RUN mkdir -p /etc/torrc.d && chmod -R 400 /etc/torrc.d
RUN mkdir -p /var/vlogs && touch /var/vlogs/web && chmod -R 600 /var/vlogs
# Volumes
VOLUME ["/etc/torrc.d", "/data", "/var/vlogs"]
# run the app
# Run the app
EXPOSE 5173/tcp
CMD [ "npm", "run", "dev", "--", "--host" ]

View File

@ -9,7 +9,7 @@ services:
# You can use `openssl rand -base64 8` to generate a secure password
- UI_PASSWORD=super-secret-password
image: litehex/wireadmin
image: wireadmin
container_name: wireadmin
restart: unless-stopped
volumes:

View File

@ -7,7 +7,7 @@ ENV_FILE="/app/.env"
log() {
local level=$1
local message=$2
echo -e "\n[$(date +"%Y-%m-%d %H:%M:%S")] [$level] $message"
echo "[$(date +"%Y-%m-%d %H:%M:%S")] [$level] $message"
}
to_camel_case() {
@ -18,8 +18,6 @@ generate_tor_config() {
# IP address of the container
local inet_address="$(hostname -i | awk '{print $1}')"
log "notice" "Using the following IP address for the Tor network: $inet_address"
sed -i "s/{{INET_ADDRESS}}/$inet_address/g" "${TOR_CONFIG}"
# any other environment variables that start with TOR_ are added to the torrc
@ -39,7 +37,10 @@ generate_tor_config() {
# any file in it, adding them to the torrc file
local torrc_files=$(find /etc/torrc.d -type f -name "*.conf")
if [ -n "${torrc_files}" ]; then
log "notice" "Found torrc.d folder with configuration files"
for file in ${torrc_files}; do
log "notice" "Adding $file to the main torrc file"
cat "$file" >>"${TOR_CONFIG}"
done
fi
@ -96,10 +97,6 @@ fi
awk -F= '!a[$1]++' "${ENV_FILE}" >"/tmp/$(basename "${ENV_FILE}")" &&
mv "/tmp/$(basename "${ENV_FILE}")" "${ENV_FILE}"
# Starting Redis server in detached mode
screen -L -Logfile /var/vlogs/redis -dmS "redis" \
bash -c "redis-server --port 6479 --daemonize no --dir /data --appendonly yes"
# Generate Tor configuration
generate_tor_config

View File

@ -1,7 +1,6 @@
{
"name": "wireadmin",
"version": "1.0.0",
"description": "",
"version": "0.0.0-dev",
"scripts": {
"dev": "docker compose rm -fsv && docker compose -f docker-compose.yml -f docker-compose.dev.yml up",
"dev:image": "docker buildx build --tag wireadmin -f Dockerfile-Dev .",

View File

@ -1,6 +1,6 @@
{
"name": "web",
"version": "1.1.2",
"version": "0.0.0-dev",
"type": "module",
"scripts": {
"dev": "vite dev",