Feature/podman (#3)
Some checks failed
Build teams container / Build image (push) Has been cancelled

* Changed to Podman

* added option to use podman or docker on host

* Feature/podman fix (#1)

* WIP

* WIP

* restored dockerfile

* podman works rootless savepoint

* added bin folder

* changed teams-two to podman

* changed to podman scheme

* updated Makefile

* updated README.md

* host script refactor

* renamed Dockerfile to Containerfile for podman scheme

* added ci

* changed ci script name

* tried changing repo name

* prepared merge with main. Added config to swap container runtime with ease

* added podman explanation to readme

* improved the runtime_switching experience

* fixed path mistake in env loading
This commit is contained in:
ChristofferNissen
2022-01-23 18:20:34 +01:00
committed by GitHub
parent 589d2c5263
commit 9416420267
4 changed files with 48 additions and 16 deletions

View File

@@ -16,12 +16,12 @@ build-no-cache:
install: install:
${CONTAINER_ENGINE} run -it --rm --privileged \ ${CONTAINER_ENGINE} run -it --rm --privileged \
--volume ./bin:/target \ --volume ${PWD}/bin:/target \
docker.io/stifstof/teams-desktop:latest install docker.io/stifstof/teams-desktop:latest install
uninstall: uninstall:
${CONTAINER_ENGINE} run -it --rm --privileged \ ${CONTAINER_ENGINE} run -it --rm --privileged \
--volume ./bin:/target \ --volume ${PWD}/bin:/target \
docker.io/stifstof/teams-desktop:latest uninstall docker.io/stifstof/teams-desktop:latest uninstall
# convenience jobs # convenience jobs
@@ -44,11 +44,11 @@ create-empty-config-folders:
add-to-path: add-to-path:
export PATH=$PATH:/home/cn/Documents/git/TeamsInDocker/bin export PATH=$PATH:/home/cn/Documents/git/TeamsInDocker/bin
podman: podman_runtime:
rm -f .env rm -f .env
echo "CONTAINER_ENGINE=podman" >> .env echo "CONTAINER_ENGINE=podman" >> .env
docker: docker_runtime:
rm -f .env rm -f .env
echo "CONTAINER_ENGINE=docker" >> .env echo "CONTAINER_ENGINE=docker" >> .env

View File

@@ -6,8 +6,8 @@ This projects objective is to provide Microsoft Teams as a container to enable m
Currently the project supports Docker and Podman. Select which runtime you want with the convenient make targets: Currently the project supports Docker and Podman. Select which runtime you want with the convenient make targets:
Makefile (System setup) Makefile (System setup)
- docker - docker_runtime
- podman - podman_runtime
- current_runtime - current_runtime
The default runtime is Docker. Select podman with "make podman" and confirm with "make current_runtime". The default runtime is Docker. Select podman with "make podman" and confirm with "make current_runtime".
@@ -23,6 +23,10 @@ Makefile
- uninstall - uninstall
- build - build
# Supported Container Runtimes
Podman has been added as an alternative to Docker, to enable use on systems without root access. When using Podman, the container user's root will only have the permission of the user executing podman, and the container user will have UID > 10000 as per best practice recommendations.
# Old Readme # Old Readme
This project is inspired from te works of gfa01/slack-desktop, but instead for Microsoft Teams. The old README explains the use of PulseAudio and XServer well This project is inspired from te works of gfa01/slack-desktop, but instead for Microsoft Teams. The old README explains the use of PulseAudio and XServer well

View File

@@ -9,16 +9,23 @@ IMAGE_NAME="docker.io/stifstof/teams-desktop:latest"
CONTAINER_NAME="teams" CONTAINER_NAME="teams"
CONFIG_PATH="${HOME}/.config/Microsoft" CONFIG_PATH="${HOME}/.config/Microsoft"
########## Script
# Container runtime (docker or podman) # Container runtime (docker or podman)
CONTAINER_ENGINE="${CONTAINER_ENGINE}" CONTAINER_ENGINE="${CONTAINER_ENGINE}"
# Local .env
if [ -f "/home/$LOCAL_COMPUTER_USERNAME/Documents/git/TeamsInDocker/.env" ]; then
# Load Environment Variables
export $(cat /home/$LOCAL_COMPUTER_USERNAME/Documents/git/TeamsInDocker/.env | grep -v '#' | awk '/=/ {print $1}')
# For instance, will be example_kaggle_key
echo $CONTAINER_ENGINE
fi
if [ -z "$CONTAINER_ENGINE" ] if [ -z "$CONTAINER_ENGINE" ]
then then
echo "\$CONTAINER_ENGINE is empty. Defaulting to podman" echo "\$CONTAINER_ENGINE is empty. Defaulting to docker"
CONTAINER_ENGINE="podman" CONTAINER_ENGINE="docker"
fi fi
########## Script
PATH=/home/cn/Documents/git/TeamsInDocker/bin:/usr/sbin:/usr/bin:/sbin:/bin PATH=/home/cn/Documents/git/TeamsInDocker/bin:/usr/sbin:/usr/bin:/sbin:/bin
TEAMS_DESKTOP_USER=${LOCAL_COMPUTER_USERNAME} TEAMS_DESKTOP_USER=${LOCAL_COMPUTER_USERNAME}
XSOCK=/home/$TEAMS_DESKTOP_USER/X/teamsOne/.X11-unix XSOCK=/home/$TEAMS_DESKTOP_USER/X/teamsOne/.X11-unix
@@ -63,6 +70,12 @@ cleanup_stopped_teams_desktop_instances() {
done done
} }
prepare_extra_arguments() {
if [ "$CONTAINER_ENGINE" == "docker" ]; then
TEAMS_EXTRA_CONTAINER_ARGUMENTS+="--privileged"
fi
}
prepare_container_env_parameters() { prepare_container_env_parameters() {
ENV_VARS+=" --env=USER_UID=${USER_UID}" ENV_VARS+=" --env=USER_UID=${USER_UID}"
ENV_VARS+=" --env=USER_GID=${USER_GID}" ENV_VARS+=" --env=USER_GID=${USER_GID}"
@@ -131,6 +144,7 @@ cleanup_stopped_teams_desktop_instances
prepare_container_env_parameters prepare_container_env_parameters
prepare_container_volume_parameters prepare_container_volume_parameters
prepare_container_device_parameters prepare_container_device_parameters
prepare_extra_arguments
echo "Starting ${prog}..." echo "Starting ${prog}..."
set -o xtrace set -o xtrace
@@ -141,8 +155,8 @@ ${SUDO} ${CONTAINER_ENGINE} run -d \
--shm-size=4g \ --shm-size=4g \
--device /dev/dri \ --device /dev/dri \
--device /dev/snd \ --device /dev/snd \
${TEAMS_EXTRA_CONTAINER_ARGUMENTS} \
${ENV_VARS} \ ${ENV_VARS} \
${VIDEO_DEVICES} \ ${VIDEO_DEVICES} \
${VOLUMES} \ ${VOLUMES} \
${TEAMS_EXTRA_CONTAINER_ARGUMENTS} \
${IMAGE_NAME} ${prog} $@ >/dev/null ${IMAGE_NAME} ${prog} $@ >/dev/null

View File

@@ -9,16 +9,23 @@ IMAGE_NAME="docker.io/stifstof/teams-desktop:latest"
CONTAINER_NAME="teams-two" CONTAINER_NAME="teams-two"
CONFIG_PATH="${HOME}/.config/MicrosoftTwo" CONFIG_PATH="${HOME}/.config/MicrosoftTwo"
########## Script
# Container runtime (docker or podman) # Container runtime (docker or podman)
CONTAINER_ENGINE="${CONTAINER_ENGINE}" CONTAINER_ENGINE="${CONTAINER_ENGINE}"
# Local .env
if [ -f "/home/$LOCAL_COMPUTER_USERNAME/Documents/git/TeamsInDocker/.env" ]; then
# Load Environment Variables
export $(cat /home/$LOCAL_COMPUTER_USERNAME/Documents/git/TeamsInDocker/.env | grep -v '#' | awk '/=/ {print $1}')
# For instance, will be example_kaggle_key
echo $CONTAINER_ENGINE
fi
if [ -z "$CONTAINER_ENGINE" ] if [ -z "$CONTAINER_ENGINE" ]
then then
echo "\$CONTAINER_ENGINE is empty. Defaulting to podman" echo "\$CONTAINER_ENGINE is empty. Defaulting to docker"
CONTAINER_ENGINE="podman" CONTAINER_ENGINE="docker"
fi fi
########## Script
PATH=/home/cn/Documents/git/TeamsInDocker/bin:/usr/sbin:/usr/bin:/sbin:/bin PATH=/home/cn/Documents/git/TeamsInDocker/bin:/usr/sbin:/usr/bin:/sbin:/bin
TEAMS_DESKTOP_USER=${LOCAL_COMPUTER_USERNAME} TEAMS_DESKTOP_USER=${LOCAL_COMPUTER_USERNAME}
XSOCK=/home/$TEAMS_DESKTOP_USER/X/teamsTwo/.X11-unix XSOCK=/home/$TEAMS_DESKTOP_USER/X/teamsTwo/.X11-unix
@@ -63,6 +70,12 @@ cleanup_stopped_teams_desktop_instances() {
done done
} }
prepare_extra_arguments() {
if [ "$CONTAINER_ENGINE" == "docker" ]; then
TEAMS_EXTRA_CONTAINER_ARGUMENTS+="--privileged"
fi
}
prepare_container_env_parameters() { prepare_container_env_parameters() {
ENV_VARS+=" --env=USER_UID=${USER_UID}" ENV_VARS+=" --env=USER_UID=${USER_UID}"
ENV_VARS+=" --env=USER_GID=${USER_GID}" ENV_VARS+=" --env=USER_GID=${USER_GID}"
@@ -131,6 +144,7 @@ cleanup_stopped_teams_desktop_instances
prepare_container_env_parameters prepare_container_env_parameters
prepare_container_volume_parameters prepare_container_volume_parameters
prepare_container_device_parameters prepare_container_device_parameters
prepare_extra_arguments
echo "Starting ${prog}..." echo "Starting ${prog}..."
set -o xtrace set -o xtrace
@@ -141,8 +155,8 @@ ${SUDO} ${CONTAINER_ENGINE} run -d \
--shm-size=4g \ --shm-size=4g \
--device /dev/dri \ --device /dev/dri \
--device /dev/snd \ --device /dev/snd \
${TEAMS_EXTRA_CONTAINER_ARGUMENTS} \
${ENV_VARS} \ ${ENV_VARS} \
${VIDEO_DEVICES} \ ${VIDEO_DEVICES} \
${VOLUMES} \ ${VOLUMES} \
${TEAMS_EXTRA_CONTAINER_ARGUMENTS} \
${IMAGE_NAME} ${prog} $@ >/dev/null ${IMAGE_NAME} ${prog} $@ >/dev/null