Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@chinyeungli
Copy link
Contributor

Fixed #341

Create a script to use Docker container to build a Debian package.

Once the .deb is generated, one can install the package by

sudo apt install ./<package>.deb

Note: The ./ is important - it tells apt to install from a local file
rather than searching repositories.

Once it's installed, one can run the binary directly

dejacode

I need the following to run the test after installed the debian package

Create and configure a PostgreSQL user named dejacode

psql -h localhost -U postgres -c "CREATE USER dejacode; ALTER USER dejacode CREATEDB; GRANT ALL PRIVILEGES ON DATABASE dejacode TO dejacode;" 2>/dev/null || psql -h localhost -U postgres -c "ALTER USER dejacode CREATEDB; GRANT ALL PRIVILEGES ON DATABASE dejacode TO dejacode;"

Assuming the system has postgresql, if not, install it with

sudo apt install postgresql-client

Sets up environment variables and runs a test

PGPASSWORD="password" SECRET_KEY=secret dejacode test
  • Replace the "password" with the PostgreSQL password

Output

thomas@DESKTOP-6IMEJ77:~$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.0
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
thomas@DESKTOP-6IMEJ77:~$ dejacode

Type 'dejacode help <subcommand>' for help on a specific subcommand.

Available subcommands:

[django]
    check
    compilemessages
    createcachetable
    dbshell
    diffsettings
    dumpdata
    flush
    inspectdb
    loaddata
    makemessages
    makemigrations
    migrate
    optimizemigration
    runserver
    sendtestemail
    shell
    showmigrations
    sqlflush
    sqlmigrate
    sqlsequencereset
    squashmigrations
    startapp
    startproject
    test
    testserver
Note that only Django core commands are listed as settings are not properly configured (error: Set the SECRET_KEY environment variable).
thomas@DESKTOP-6IMEJ77:~$

Signed-off-by: Chin Yeung Li [email protected]

@tdruez tdruez merged commit b6f8ec8 into main Nov 18, 2025
4 checks passed
@tdruez tdruez deleted the 341_packaging_for_debian branch November 18, 2025 11:08
@tdruez
Copy link
Contributor

tdruez commented Nov 18, 2025

Tested the package build and package installation successfully:

$ python build_deb_docker.py
....
Success! Debian package built: dist/debian/python3-dejacode_5.4.1_all.deb
$ docker run -it -v $(pwd)/dist:/dist debian:latest bash

root@fa1d1802b062:/dist/debian# apt install ./python3-dejacode_5.4.1_all.deb
Note, selecting 'python3-dejacode' instead of './python3-dejacode_5.4.1_all.deb'
Installing:
  python3-dejacode

Summary:
  Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 0
  Download size: 0 B / 303 MB
  Space needed: 0 B / 52.0 GB available

Get:1 /dist/debian/python3-dejacode_5.4.1_all.deb python3-dejacode all 5.4.1 [303 MB]
Selecting previously unselected package python3-dejacode.
(Reading database ... 33748 files and directories currently installed.)
Preparing to unpack .../python3-dejacode_5.4.1_all.deb ...
Unpacking python3-dejacode (5.4.1) ...
Setting up python3-dejacode (5.4.1) ...

...

$ dejacode 
Type 'dejacode help <subcommand>' for help on a specific subcommand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRAVEX-integration: Packaging for Debian

2 participants