This is a dockerfile that create an docker image for azure app service.
It contain crontab and service conrol and runit. similar to https://github.com/phusion/baseimage-docker , but this is Ubuntu 18.04.
And other stuff. Such as ssh(https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-ssh-support).
Prepare build kit
# make your computer able to rum arm64 binary
docker run --rm --privileged docker/binfmt:820fdd95a9972a5308930a2bdfb8573dd4447ad3
# enable expremental feature
export DOCKER_CLI_EXPERIMENTAL=enabled
export DOCKER_BUILDKIT=1
docker buildx create --name mybuilder_az --driver docker-container
docker buildx use mybuilder_az
Build in local
docker buildx build --platform linux/amd64 -t whojk/ubuntu-azure-apps . --output="type=docker"
#Test in localhost
docker run -it --rm --env-file=env_file_example --name=az whojk/ubuntu-azure-apps
docker exec -it az bash
Build and push
docker buildx build --platform linux/arm64,linux/amd64 -t whojk/ubuntu-azure-apps . --push
Upload to the docker hub, and deploy it to azure app service
- /etc/init.d/rcS
- /etc/rc.local
- all services stored at /etc/service
APT_UPDATE
:0/1
, runapt update
at startupAPT_UPGRADE
:0/1
, runapt upgrade
at startupUPTIME_LOG
:0/1
, enable uptime log at/root/.log/uptime.log
TZ
: Time zone
COMMAND_SSH
:0/1
: ssh server for receive external commandAUTOSSH
:0/1
, use autossh to expose ssh port on remote server to receive external commandSSH_KEY
: printf formatted id_rsa openssh private key file, use to connect to your serverSSH_KNOW_HOSTS
: printf formatted known_hosts file, use to connect to your server without asking unknow hostsSSH_AUTHED_KEYS
: printf formatted authorized_keys file. Use to allow remote incoming connection(password is disabled)SSH_USER
: username to connect to ssh serverSSH_CONN
: domain/ip to connect to ssh serverSSH_CONN_PORT
: port to connect to ssh serverRSSH_REMOTE_MONITOR_PORT
: monitoring port of autosshRSSH_REMOTE_PORT
: ssh will exposed on this port on the remote server
FRPC
:0/1
, use frp client to expose ssh port on remote server to receive external commandFRPC_CONN
: frp server domainFRPC_CONN_PORT
: frp server portFRPC_USER
: frp userFRPC_TOKEN
: frp tokenFRPC_PROTO
: frp protocol. tcp/kcp/websocketFRPC_REMOTE_PORT
: ssh will exposed on this port on the remote server
CLOUDFLARED
:0/1
, enable cloudflaredCLOUDFLARED_CERT
: printf formatted cert.pemCLOUDFLARED_LOCAL_PORT
: cloudflared proxied internal portCLOUDFLARED_DOMAIN
: cloudflaredJUPYTER
:0/1
, enable internal jupyter serverJUPYTER_LOCAL_PORT
: internal jupyter server port, if you want to expost it via cloudfalre, must be same asCLOUDFLARED_LOCAL_PORT
JUPYTER_PASSWORD
V2RAY
:0/1
, enable v2ray serverV2RAY_LOCAL_PORT
: internal v2ray server port. Must be unique to other servicesV2RAY_PATH
: v2ray path.V2RAY_UUIDS
: split uuid with:
INIT_STARTUP
: run/etc/init.d/{program} start
at startup.- Format: split service name with
:
- Supported value:
mongodb
mysql
php7.4-fpm
postgresql
tor
- Format: split service name with
- Other Variables:
You can checkout this example environment variables file: env_file_example