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:
${CONTAINER_ENGINE} run -it --rm --privileged \
--volume ./bin:/target \
--volume ${PWD}/bin:/target \
docker.io/stifstof/teams-desktop:latest install
uninstall:
${CONTAINER_ENGINE} run -it --rm --privileged \
--volume ./bin:/target \
--volume ${PWD}/bin:/target \
docker.io/stifstof/teams-desktop:latest uninstall
# convenience jobs
@@ -44,11 +44,11 @@ create-empty-config-folders:
add-to-path:
export PATH=$PATH:/home/cn/Documents/git/TeamsInDocker/bin
podman:
podman_runtime:
rm -f .env
echo "CONTAINER_ENGINE=podman" >> .env
docker:
docker_runtime:
rm -f .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:
Makefile (System setup)
- docker
- podman
- docker_runtime
- podman_runtime
- current_runtime
The default runtime is Docker. Select podman with "make podman" and confirm with "make current_runtime".
@@ -23,6 +23,10 @@ Makefile
- uninstall
- 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
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"
CONFIG_PATH="${HOME}/.config/Microsoft"
########## Script
# Container runtime (docker or podman)
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" ]
then
echo "\$CONTAINER_ENGINE is empty. Defaulting to podman"
CONTAINER_ENGINE="podman"
echo "\$CONTAINER_ENGINE is empty. Defaulting to docker"
CONTAINER_ENGINE="docker"
fi
########## Script
PATH=/home/cn/Documents/git/TeamsInDocker/bin:/usr/sbin:/usr/bin:/sbin:/bin
TEAMS_DESKTOP_USER=${LOCAL_COMPUTER_USERNAME}
XSOCK=/home/$TEAMS_DESKTOP_USER/X/teamsOne/.X11-unix
@@ -63,6 +70,12 @@ cleanup_stopped_teams_desktop_instances() {
done
}
prepare_extra_arguments() {
if [ "$CONTAINER_ENGINE" == "docker" ]; then
TEAMS_EXTRA_CONTAINER_ARGUMENTS+="--privileged"
fi
}
prepare_container_env_parameters() {
ENV_VARS+=" --env=USER_UID=${USER_UID}"
ENV_VARS+=" --env=USER_GID=${USER_GID}"
@@ -131,6 +144,7 @@ cleanup_stopped_teams_desktop_instances
prepare_container_env_parameters
prepare_container_volume_parameters
prepare_container_device_parameters
prepare_extra_arguments
echo "Starting ${prog}..."
set -o xtrace
@@ -141,8 +155,8 @@ ${SUDO} ${CONTAINER_ENGINE} run -d \
--shm-size=4g \
--device /dev/dri \
--device /dev/snd \
${TEAMS_EXTRA_CONTAINER_ARGUMENTS} \
${ENV_VARS} \
${VIDEO_DEVICES} \
${VOLUMES} \
${TEAMS_EXTRA_CONTAINER_ARGUMENTS} \
${IMAGE_NAME} ${prog} $@ >/dev/null

View File

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