-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 fix(permissions): Change user permissions to map current user (#19)
- Loading branch information
Showing
7 changed files
with
97 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
log/mosquitto.log | ||
config/mosquitto.conf | ||
config/password.txt | ||
config/password.txt | ||
docker-compose.override.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM eclipse-mosquitto:2 | ||
|
||
ARG UID | ||
ARG GID | ||
ARG USER | ||
|
||
RUN if [ ${USER} != "root" ]; then \ | ||
apk add shadow && \ | ||
groupadd -f -g ${GID} ${USER} && \ | ||
useradd -m -g ${USER} -u ${UID} ${USER}; \ | ||
fi | ||
|
||
RUN chown -R ${USER}:${USER} /mosquitto | ||
|
||
USER ${USER} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Executables: local only | ||
DOCKER_COMP = docker compose | ||
DOCKER_COMP_EXEC = $(DOCKER_COMP) exec mosquitto | ||
|
||
# Misc | ||
.DEFAULT_GOAL = help | ||
|
||
help: ## Outputs this help screen | ||
@grep -E '(^[a-zA-Z0-9_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/' | ||
|
||
alias: ## Displays all alias of the package manager | ||
$(DOCKER_COMP_EXEC) npm run | ||
|
||
## —— Docker 🐳 ———————————————————————————————————————————————————————————————— | ||
build: ## Builds the Node image | ||
$(DOCKER_COMP) build | ||
|
||
up: ## Starts the docker hub | ||
$(DOCKER_COMP) up -d | ||
|
||
down: ## Stops the docker hub | ||
$(DOCKER_COMP) down --remove-orphans | ||
|
||
restart: ## Restarts the docker hub | ||
$(DOCKER_COMP) restart | ||
|
||
sh: ## Connects to the application container | ||
$(DOCKER_COMP_EXEC) sh | ||
|
||
logs: ## Displays the logs of the application container | ||
$(DOCKER_COMP) logs -f mosquitto | ||
|
||
## —— Project 🐝 ——————————————————————————————————————————————————————————————— | ||
setup-project: ## Initializes configuration | ||
bin/setup | ||
make build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
projectRootPath=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )/.. | ||
|
||
if [ ! -f ${projectRootPath}/docker-compose.override.yml ]; then | ||
cp ${projectRootPath}/docker-compose.override.yml.dist ${projectRootPath}/docker-compose.override.yml | ||
|
||
sed -i'' -e "s/\[GID\]/$(id -g)/g" ${projectRootPath}/docker-compose.override.yml; | ||
sed -i'' -e "s/\[UID\]/$(id -u)/g" ${projectRootPath}/docker-compose.override.yml; | ||
|
||
username=$(id -un) | ||
|
||
if [ "$username" != "root" ]; then | ||
username="unicorn" | ||
fi | ||
|
||
sed -i'' -e "s/\[USER\]/${username}/g" ${projectRootPath}/docker-compose.override.yml; | ||
|
||
rm -f docker-compose.override.yml-e # Hack for MAC OS | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
services: | ||
mosquitto: | ||
build: | ||
args: | ||
GID: [GID] | ||
UID: [UID] | ||
USER: [USER] | ||
user: [UID]:[GID] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters