set_image localhost/python_app_image:latest

# mount app sources and data:
# - relative paths are in /var/app/rollback/volumes and can be
# rolled back on failed upgrades, suitable for application sources
# and assets.
# - /var/app/volumes is not copied on updates and more suitable
# for volatile data such as logs and databases.
add_volumes python_app:/vol_app
add_volumes /var/app/volumes/python_app:/vol_data

add_volumes /tmp/share:/share                           # 電源ON時のみ共有

#add_volumes /var/app/volumes/sd:/home/atmark           #SDを/home/atmarkにマウント
add_volumes /var/app/volumes/usb:/home/atmark           #USBを/home/atmarkにマウント

# /var/app/rollback/volumes とコンテナ内のリンク
add_volumes www_html:/var/www/html                      # Webアプリ格納先
add_volumes etc_lighttpd:/etc/lighttpd                  # lighttpd + php-cgi
add_volumes etc_php:/etc/php/8.2/cgi                    # ダウンロードファイルサイズ拡張 + マルチバイト文字
add_volumes etc_vsftpd:/etc/vsftpd                      # passwd
add_volumes vsftpd.conf:/etc/vsftpd.conf                # FTPサーバの設定
add_volumes startup.sh:/startup.sh                      # python & lighttpd & vsftpd 起動スクリプト

# Allow LED to be written. This is application specific
# and should be changed depending on your needs.
add_volumes /sys:/sys

# python bufferizes its output by default when stdout is not a terminal,
# so print() statements would only be printed after a sufficient number
# of messages have accumulated. Force immediate output without flush for
# convenient logging
add_args -t                                             # コンテナに tty を渡しデバッグターミナル出力
set_network host                                        # コンテナを実行するネットワークとして host を指定

# 全デバイス(/dev)の使用権限付与
#add_args --privileged
add_devices /dev/gpiochip0 /dev/ttymxc4 /dev/spidev0.0  # GPIO CON9 & uart5 & spi1

# launch app
#set_command python3 /vol_app/src/main.py
set_command sh /startup.sh
