在 docker-compose 的 makefile 中导出当前用户 ID

mat*_*ish 10 makefile docker docker-compose

我试图将当前用户 ID 传递给 docker-compose.yml

它看起来如何 docker-compose.yml

version: '3.4'

services:
    app:
        build:
            context: ./
            target: "php-${APP_ENV}"
        user: "${CURRENT_UID}"
Run Code Online (Sandbox Code Playgroud)

而不是CURRENT_UID=$(id -u):$(id -g) docker-compose up -d我写了makefile

#!/usr/bin/make

SHELL = /bin/sh

up: 
    export CURRENT_UID=$(id -u):$(id -g)
    docker-compose up -d
Run Code Online (Sandbox Code Playgroud)

但是CURRENT_UID我跑的时候还是空的make up

makefile 中是否有可能的导出 uid?

mat*_*ish 15

这是我的解决方案

#!/usr/bin/make

SHELL = /bin/sh

CURRENT_UID := $(shell id -u)
CURRENT_GID := $(shell id -g)

export CURRENT_UID
export CURRENT_GID

up: 

    docker-compose up -d
Run Code Online (Sandbox Code Playgroud)