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
34 changes: 18 additions & 16 deletions .github/workflows/docker-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ on:
branches:
- '**'
pull_request:
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
image: ['', v, fpm, fpm-alpine, fpm-alpine-nginx, fpm-alpine-nginx-composer, fpm-alpine-nginx-composer-supervisor]
include:
Expand All @@ -31,17 +33,17 @@ jobs:
file: fpm-alpine-nginx-composer-supervisor.Dockerfile
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Define tag name
id: tag-name
run: |
if [ "${GITHUB_REF}" == "refs/heads/master" -a "${GITHUB_EVENT_NAME}" != "pull_request" ]; then
curl -s https://api.github.com/repos/akaunting/akaunting/releases/latest \
| jq -r .tag_name | sed \
-e 's/^/::set-output name=tag::/'
-e 's/^/tag=/' >> "$GITHUB_OUTPUT"
else
echo -n "::set-output name=tag::"
echo "$GITHUB_REF" | cut -d/ -f3- | tr '/' '_'
echo -n "tag=" >> "$GITHUB_OUTPUT"
echo "$GITHUB_REF" | cut -d/ -f3- | tr '/' '_' >> "$GITHUB_OUTPUT"
fi
- name: Define images tags
id: image-tags
Expand All @@ -51,38 +53,38 @@ jobs:
echo ${{ steps.tag-name.outputs.tag }} | sed \
-e 's/\(\(\([0-9]\+\)\.[0-9]\+\)\.[0-9]\+\)/\1,\2,\3,/' \
-e 's/\([^,]\+\),/akaunting\/akaunting:\1,/g' \
-e 's/^/::set-output name=tags::/' \
-e 's/$/akaunting\/akaunting:latest/'
-e 's/^/tags=/' \
-e 's/$/akaunting\/akaunting:latest/' >> "$GITHUB_OUTPUT"
else
echo ${{ steps.tag-name.outputs.tag }} | sed \
-e 's/\(\(\([0-9]\+\)\.[0-9]\+\)\.[0-9]\+\)/\1-${{ matrix.image }},\2-${{ matrix.image }},\3-${{ matrix.image }},/' \
-e 's/\([^,]\+\),/akaunting\/akaunting:\1,/g' \
-e 's/^/::set-output name=tags::/'
-e 's/^/tags=/' >> "$GITHUB_OUTPUT"
fi
else
if [ -z ${{ matrix.image }} ]; then
echo -n "::set-output name=tags::akaunting/akaunting:"
echo "$GITHUB_REF" | cut -d/ -f3- | tr '/' '_'
echo -n "tags=akaunting/akaunting:" >> "$GITHUB_OUTPUT"
echo "$GITHUB_REF" | cut -d/ -f3- | tr '/' '_' >> "$GITHUB_OUTPUT"
else
echo -n "::set-output name=tags::akaunting/akaunting:"
echo "$(echo "$GITHUB_REF" | cut -d/ -f3- | tr '/' '_')-${{ matrix.image }}"
echo -n "tags=akaunting/akaunting:" >> "$GITHUB_OUTPUT"
echo "$(echo "$GITHUB_REF" | cut -d/ -f3- | tr '/' '_')-${{ matrix.image }}" >> "$GITHUB_OUTPUT"
fi
fi
- name: Set up QEMU
if: matrix.image == '' || matrix.image == 'v' || matrix.image == 'fpm' || matrix.image == 'fpm-alpine' || matrix.image == 'fpm-alpine-nginx'
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: matrix.image == '' || matrix.image == 'v' || matrix.image == 'fpm' || matrix.image == 'fpm-alpine' || matrix.image == 'fpm-alpine-nginx'
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push images
if: matrix.image == '' || matrix.image == 'v' || matrix.image == 'fpm' || matrix.image == 'fpm-alpine' || matrix.image == 'fpm-alpine-nginx'
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.file }}
Expand All @@ -91,7 +93,7 @@ jobs:
tags: ${{ steps.image-tags.outputs.tags }}
- name: Build and push images
if: matrix.image == 'fpm-alpine-nginx-composer' || matrix.image == 'fpm-alpine-nginx-composer-supervisor'
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.file }}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1-apache
FROM php:8.2.35-apache

ARG AKAUNTING_DOCKERFILE_VERSION=0.1
ARG SUPPORTED_LOCALES="en_US.UTF-8"
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,35 @@ SESSION_DRIVER: "redis"
QUEUE_CONNECTION: "redis"
```

## Upgrading

The application files live in the `akaunting-data` volume, so pulling a newer image updates PHP and the system packages but **not** Akaunting itself. Upgrade Akaunting from inside the running container instead.

> Akaunting 3.2 and later require PHP 8.2. Always switch to the new image **before** upgrading Akaunting. Upgrading Akaunting on an old PHP 8.1 image leaves the application unable to start.

1. Back up your database:

```shell
docker exec akaunting-db sh -c 'exec mariadb-dump -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE"' > akaunting-backup.sql
```

2. Pull the new image and recreate the container:

```shell
docker-compose pull
docker-compose up -d
```

3. Upgrade Akaunting and its installed apps:

```shell
docker exec -u www-data akaunting php artisan update:all
```

You can also do this step from **Settings > Updates** in the Akaunting web interface.

Do not just copy the new files over the old ones and run `php artisan migrate`. Some versions also update existing data during the upgrade, and that step only runs through the updater.

## Extra ways to explore containerized Akaunting!
This repository contains extra compose and other files that allows you to run Akaunting in different setups like using FPM and NGINX and here is the most important commands that you may need:

Expand Down
14 changes: 9 additions & 5 deletions fpm-alpine-nginx-composer-supervisor.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM php:8.1-fpm-alpine3.15
FROM php:8.2.35-fpm-alpine3.24

# Arguments defined in docker-compose.yml
ARG AKAUNTING_DOCKERFILE_VERSION=0.1
ARG SUPPORTED_LOCALES="en_US.UTF-8"

# Add Repositories
RUN rm -f /etc/apk/repositories &&\
echo "http://dl-cdn.alpinelinux.org/alpine/v3.15/main" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/v3.15/community" >> /etc/apk/repositories
echo "http://dl-cdn.alpinelinux.org/alpine/v3.24/main" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/v3.24/community" >> /etc/apk/repositories

# Add Dependencies
RUN apk add --update --no-cache \
Expand All @@ -18,11 +18,15 @@ RUN apk add --update --no-cache \
supervisor \
vim \
bash \
nodejs \
npm \
git \
nginx

# Add Node.js 20 (Akaunting requires node >=18 <21 and node-sass does not build on the Node.js 24 shipped by Alpine 3.24)
COPY --from=node:20.20.2-alpine3.23 /usr/local/bin/node /usr/local/bin/node
COPY --from=node:20.20.2-alpine3.23 /usr/local/lib/node_modules /usr/local/lib/node_modules
RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
&& ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx

ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

# Install PHP Extensions
Expand Down
14 changes: 9 additions & 5 deletions fpm-alpine-nginx-composer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM php:8.1-fpm-alpine3.15
FROM php:8.2.35-fpm-alpine3.24

# Arguments defined in docker-compose.yml
ARG AKAUNTING_DOCKERFILE_VERSION=0.1
ARG SUPPORTED_LOCALES="en_US.UTF-8"

# Add Repositories
RUN rm -f /etc/apk/repositories &&\
echo "http://dl-cdn.alpinelinux.org/alpine/v3.15/main" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/v3.15/community" >> /etc/apk/repositories
echo "http://dl-cdn.alpinelinux.org/alpine/v3.24/main" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/v3.24/community" >> /etc/apk/repositories

# Add Dependencies
RUN apk add --update --no-cache \
Expand All @@ -17,11 +17,15 @@ RUN apk add --update --no-cache \
python3 \
nano \
bash \
nodejs \
npm \
git \
nginx

# Add Node.js 20 (Akaunting requires node >=18 <21 and node-sass does not build on the Node.js 24 shipped by Alpine 3.24)
COPY --from=node:20.20.2-alpine3.23 /usr/local/bin/node /usr/local/bin/node
COPY --from=node:20.20.2-alpine3.23 /usr/local/lib/node_modules /usr/local/lib/node_modules
RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
&& ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx

ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

# Install PHP Extensions
Expand Down
6 changes: 3 additions & 3 deletions fpm-alpine-nginx.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM php:8.1-fpm-alpine3.15
FROM php:8.2.35-fpm-alpine3.24

# Arguments defined in docker-compose.yml
ARG AKAUNTING_DOCKERFILE_VERSION=0.1
ARG SUPPORTED_LOCALES="en_US.UTF-8"

# Add Repositories
RUN rm -f /etc/apk/repositories &&\
echo "http://dl-cdn.alpinelinux.org/alpine/v3.15/main" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/v3.15/community" >> /etc/apk/repositories
echo "http://dl-cdn.alpinelinux.org/alpine/v3.24/main" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/v3.24/community" >> /etc/apk/repositories

# Add Dependencies
RUN apk add --update --no-cache \
Expand Down
6 changes: 3 additions & 3 deletions fpm-alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM php:8.1-fpm-alpine3.15
FROM php:8.2.35-fpm-alpine3.24

# Arguments defined in docker-compose.yml
ARG AKAUNTING_DOCKERFILE_VERSION=0.1
ARG SUPPORTED_LOCALES="en_US.UTF-8"

# Add Repositories
RUN rm -f /etc/apk/repositories &&\
echo "http://dl-cdn.alpinelinux.org/alpine/v3.15/main" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/v3.15/community" >> /etc/apk/repositories
echo "http://dl-cdn.alpinelinux.org/alpine/v3.24/main" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/v3.24/community" >> /etc/apk/repositories

# Add Build Dependencies
RUN apk add --no-cache --virtual .build-deps \
Expand Down
2 changes: 1 addition & 1 deletion fpm.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1-fpm
FROM php:8.2.35-fpm

# Arguments defined in docker-compose.yml
ARG AKAUNTING_DOCKERFILE_VERSION=0.1
Expand Down
2 changes: 1 addition & 1 deletion v.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1-apache
FROM php:8.2.35-apache

ARG AKAUNTING_DOCKERFILE_VERSION=0.1
ARG SUPPORTED_LOCALES="en_US.UTF-8"
Expand Down
Loading