Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .examples/docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# optional Image Configuration
#DOCKER_APP_IMAGE=librebooking/librebooking
#DOCKER_APP_TAG=5.2.0
#DOCKER_APP_TAG=7.2.0
#DOCKER_DB_IMAGE=linuxserver/mariadb
#DOCKER_DB_TAG:10.6.13

Expand Down
4 changes: 2 additions & 2 deletions .examples/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ docker run \
--volume librebooking-app_img:/var/www/html/Web/uploads/images \
--volume librebooking-app_res:/var/www/html/Web/uploads/reservation \
--env-file lb.env \
docker.io/librebooking/librebooking:develop
docker.io/librebooking/librebooking:nightly

docker run \
--name librebooking-cron \
Expand All @@ -48,7 +48,7 @@ docker run \
--volumes-from librebooking-app\
--volume ./crontab:/config/lb-jobs-cron:ro \
--env-file lb.env \
docker.io/librebooking/librebooking:develop \
docker.io/librebooking/librebooking:nightly \
supercronic /config/lb-jobs-cron
```

Expand Down
4 changes: 2 additions & 2 deletions .examples/docker/docker-compose-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
env_file:
- db.env
app:
image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-develop}
image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-nightly}
restart: always
depends_on:
- db
Expand All @@ -22,7 +22,7 @@ services:
env_file:
- lb.env
cron:
image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-develop}
image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-nightly}
restart: always
command: supercronic /config/lb-jobs-cron
depends_on:
Expand Down
4 changes: 2 additions & 2 deletions .examples/docker/docker-compose-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
env_file:
- db.env
app:
image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-develop}
image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-nightly}
restart: always
depends_on:
- db
Expand All @@ -51,7 +51,7 @@ services:
- VIRTUAL_PORT=8080
- LETSENCRYPT_HOST=acme.org
cron:
image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-develop}
image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-nightly}
restart: always
depends_on:
- app
Expand Down
2 changes: 1 addition & 1 deletion .examples/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ spec:
# value: https://librebooking.example.com/Web
# - name: VIRTUAL_HOST
# value: librebooking.example.com
image: docker.io/librebooking/librebooking:develop
image: docker.io/librebooking/librebooking:nightly
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
Expand Down
4 changes: 2 additions & 2 deletions .examples/podman/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ podman container create \
--volume librebooking-app_img:/var/www/html/Web/uploads/images:U \
--volume librebooking-app_res:/var/www/html/Web/uploads/reservation:U \
--env-file $(pwd)/lb.env \
docker.io/librebooking/librebooking:develop
docker.io/librebooking/librebooking:nightly
```

If desired, add the cron container to the pod
Expand All @@ -50,7 +50,7 @@ podman container create \
--volumes-from librebooking-app \
--volume $(pwd)/crontab:/config/lb-jobs-cron:U \
--env-file $(pwd)/lb.env \
docker.io/librebooking/librebooking:develop \
docker.io/librebooking/librebooking:nightly \
supercronic /config/lb-jobs-cron
```

Expand Down
69 changes: 60 additions & 9 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
workflow_call:
inputs:
appGitRefs:
required: true
required: false
type: string
appAddSha:
required: false
type: boolean
default: false
imgBuild:
required: true
required: false
type: string
regName:
required: true
Expand All @@ -31,14 +31,60 @@ jobs:
prepare:
runs-on: ubuntu-latest
outputs:
appTag: ${{ steps.get_meta.outputs.appTag }}
appTag: ${{ steps.set_app_tag.outputs.appTag }}
imgTag: ${{ steps.set_img_tag.outputs.imgTag }}
latest: ${{ steps.set_latest.outputs.latest }}
env:
GH_TOKEN: ${{ github.token }}
steps:
-
name: Get the docker image metadata
id: get_meta
id: get_latest_tags
name: Check latest releases for librebooking/librebooking and librebooking/docker
run: |
latestAppTag=$(gh release view -R librebooking/librebooking --json tagName -q .tagName)
echo "latestAppTag=${latestAppTag#[vV]}" >> $GITHUB_OUTPUT
latestImgTag=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName)
echo "latestImgTag=${latestImgTag#[vV]}" >> $GITHUB_OUTPUT
-
id: set_app_tag
name: Set the application tag
env:
appGitRefs: ${{ inputs.appGitRefs }}
run: |
if [ -z "${appGitRefs}" ]; then
appTag=""
else
appTag=$(basename "${appGitRefs}")
fi
echo "appTag=${appTag#[vV]}" >> $GITHUB_OUTPUT

-
id: set_img_tag
name: Set the image tag
env:
imgBuild: ${{ inputs.imgBuild }}
latestImgTag: ${{ steps.get_latest_tags.outputs.latestImgTag }}
run: |
if [ -z "${imgBuild}" ]; then
imgTag="${latestImgTag}"
else
imgTag="${imgBuild}"
fi
echo "imgTag=${imgTag#[vV]}" >> "$GITHUB_OUTPUT"
-
id: set_latest
name: Check if this is the latest stable
env:
appTag: ${{ steps.set_app_tag.outputs.appTag }}
imgTag: ${{ steps.set_img_tag.outputs.imgTag }}
latestAppTag: ${{ steps.get_latest_tags.outputs.latestAppTag }}
latestImgTag: ${{ steps.get_latest_tags.outputs.latestImgTag }}
run: |
appTag=$(basename ${{ inputs.appGitRefs }} | sed -e "s/^[vV]//")
echo "appTag=$appTag" >> $GITHUB_OUTPUT
if [ "${appTag}" = "${latestAppTag}" ] && [ "${imgTag}" = "${latestImgTag}" ]; then
echo "latest=true" >> "$GITHUB_OUTPUT"
else
echo "latest=false" >> "$GITHUB_OUTPUT"
fi
build:
needs: prepare
uses: docker/github-builder/.github/workflows/build.yml@v1
Expand All @@ -51,8 +97,13 @@ jobs:
platforms: linux/amd64,linux/arm64
meta-images: ${{ inputs.regLogin }}/librebooking
meta-tags: |
type=raw,value=${{ needs.prepare.outputs.appTag }},suffix=-${{ inputs.imgBuild }}
type=raw,value=${{ needs.prepare.outputs.appTag }}
type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=nightly
type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=nightly,suffix=-${{ needs.prepare.outputs.imgTag }}
type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=develop
type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=develop,suffix=-${{ needs.prepare.outputs.imgTag }}
type=raw,enable=${{ needs.prepare.outputs.appTag != '' }},value=${{ needs.prepare.outputs.appTag }}
type=raw,enable=${{ needs.prepare.outputs.appTag != '' }},value=${{ needs.prepare.outputs.appTag }},suffix=-${{ needs.prepare.outputs.imgTag }}
type=raw,enable=${{ needs.prepare.outputs.latest }},value=latest
build-args: |
APP_GH_REF=${{ inputs.appGitRefs }}
APP_GH_ADD_SHA=${{ inputs.appAddSha }}
Expand Down
18 changes: 2 additions & 16 deletions .github/workflows/build_image_develop.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
name: Build develop image
name: Build nightly image

on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:

jobs:
get-data:
runs-on: ubuntu-latest
outputs:
releaseImg: ${{ steps.get_release_img.outputs.release }}
env:
GH_TOKEN: ${{ github.token }}
steps:
-
id: get_release_img
run:
echo "release=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName)" >> "$GITHUB_OUTPUT"
build-develop:
needs: get-data
build-nightly:
uses: $/.github/workflows/build_and_publish.yml
with:
appGitRefs: develop
appAddSha: true
imgBuild: ${{ needs.get-data.outputs.releaseImg }}
regName: ${{ vars.REGISTRY_URL }}
regLogin: ${{ vars.REGISTRY_LOGIN }}
secrets:
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/build_image_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,21 @@ jobs:
get-data:
runs-on: ubuntu-latest
outputs:
releaseImg: ${{ steps.get_release_img.outputs.release }}
releaseApp: ${{ steps.get_release_app.outputs.release }}
env:
GH_TOKEN: ${{ github.token }}
steps:
-
id: get_release_img
run:
echo "release=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName)" >> "$GITHUB_OUTPUT"
-
id: get_release_app
name: Get Librebooking latest release number
run:
echo "release=$(gh release view -R librebooking/librebooking --json tagName -q .tagName)" >> "$GITHUB_OUTPUT"
build-stable:
build-release:
needs: get-data
uses: $/.github/workflows/build_and_publish.yml
with:
appGitRefs: ${{ needs.get-data.outputs.releaseApp }}
appAddSha: false
imgBuild: ${{ needs.get-data.outputs.releaseImg }}
regName: ${{ vars.REGISTRY_URL }}
regLogin: ${{ vars.REGISTRY_LOGIN }}
secrets:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/build_on_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ on:
workflow_dispatch:
inputs:
appGitRefs:
required: true
required: false
Comment thread
colisee marked this conversation as resolved.
Resolved
description: 'Librebooking/librebooking version'
default: 'develop'
imgBuild:
required: true
required: false
description: 'Librebooking/docker version'
default: '2.5.0'
regName:
required: true
description: 'Registry name'
Expand All @@ -25,6 +23,7 @@ jobs:
uses: ./.github/workflows/build_and_publish.yml
with:
appGitRefs: ${{ inputs.appGitRefs }}
appAddSha: ${{ inputs.appGitRefs == '' }}
imgBuild: ${{ inputs.imgBuild }}
regName: ${{ inputs.regName }}
regLogin: ${{ inputs.regLogin }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/build_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
check_build:
runs-on: ubuntu-latest
env:
APP_GH_REF: develop
APP_GH_ADD_SHA: "true"
services:
mysql:
Expand Down Expand Up @@ -79,7 +78,6 @@ jobs:
build-args: |
VERSION_PHP=8.4
VERSION_COMPOSER=lts
APP_GH_REF=${{ env.APP_GH_REF }}
APP_GH_ADD_SHA=${{ env.APP_GH_ADD_SHA }}
tags: librebooking-pr:${{ github.sha }}
load: true
Expand Down
25 changes: 12 additions & 13 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ You have 2 ways to get the docker image on your host:

This is the easiest and fastest way.

- Stable branch:
- Librebooking [release](https://github.com/LibreBooking/librebooking/releases):

```sh
docker image pull librebooking/librebooking:4.0.0
docker image pull librebooking/librebooking:7.2.0
```

- Development branch:
- Librebooking on-going development:

```sh
docker image pull librebooking/librebooking:develop
docker image pull librebooking/librebooking:nightly
```

## Build the docker image
Expand All @@ -32,22 +32,21 @@ This is the easiest and fastest way.
1. Run the following commands on your host:

```sh
# Set the application release (ex: develop or v4.0.0)
APP_RELEASE=develop
if [ "${APP_RELEASE}" == "develop" ]; then
APP_GH_REF="refs/heads/${APP_RELEASE}"
# Set the application release if needed (ex: v7.2.0)
APP_GH_REF=v7.2.0
if [ -z "${APP_GH_REF}" ]; then
IMG_TAG=nightly
APP_GH_ADD_SHA=true
else
APP_GH_REF="refs/tags/${APP_RELEASE}"
IMG_TAG=${APP_GH_REF#[vV]}
APP_GH_ADD_SHA=false
fi

# Build the docker image
docker buildx build \
# Build the docker image (Docker 23+)
docker build \
--build-arg APP_GH_REF=${APP_GH_REF} \
--build-arg APP_GH_ADD_SHA=${APP_GH_ADD_SHA} \
--tag librebooking/librebooking:$(echo ${APP_RELEASE} | sed -e "s/^v//") \
--output type=docker \
--tag librebooking/librebooking:${IMG_TAG} \
.
```

Expand Down
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ FROM composer:${VERSION_COMPOSER} AS comp
# Get upstream
FROM alpine/git:${VERSION_GIT} AS upstream
ARG APP_GH_ADD_SHA=false
ARG APP_GH_REF=refs/heads/develop
ARG APP_GH_REF=""
ARG UPSTREAM_URL="https://github.com/librebooking/librebooking"
WORKDIR /upstream

RUN <<EOF
set -eu

git clone "${UPSTREAM_URL}" --branch "$(basename ${APP_GH_REF})" .
git clone "${UPSTREAM_URL}" .
if [ -n "${APP_GH_REF}" ]; then
git checkout "${APP_GH_REF#refs/heads/}"
fi

if [ "${APP_GH_ADD_SHA}" = "true" ]; then
git describe --tags --long >config/custom-version.txt
fi
Expand Down
Loading