我正在尝试在 MacOS 上构建 docker 映像,--ssh default但它不起作用。Linux 上的构建工作相同。
//Dockerfile
#syntax=docker/dockerfile:experimental
FROM node:16
WORKDIR /app
RUN chown -R node.node /app
RUN mkdir ~/.ssh/ && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
RUN --mount=type=ssh git clone git+ssh://git@github.com/account_name/repo.git
CMD tail -f /dev/null
Run Code Online (Sandbox Code Playgroud)
当我跑步时
docker build --ssh default -t my_image .
Run Code Online (Sandbox Code Playgroud)
我收到错误:
git@github.com: Permission denied (publickey)
fatal: Could not read from remote repository
Run Code Online (Sandbox Code Playgroud)
我的 ssh 密钥位于~/.ssh/id_rsa本地计算机上,并且它在 docker 之外工作。
如果我尝试在 Dockerfile 中运行:
RUN --mount=type=ssh cat ~/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)
我收到错误:
cat: /root/.ssh/id_rsa No such file or …Run Code Online (Sandbox Code Playgroud) 我正在尝试发布一个打字稿库。我不清楚如何公开所有类型和接口。这是我的设置:
mylib
???src
? ???types
| | ???mytypes.ts
? ???index.ts
???package.json
???tsconfig.json
Run Code Online (Sandbox Code Playgroud)
mylib
???src
? ???types
| | ???mytypes.ts
? ???index.ts
???package.json
???tsconfig.json
Run Code Online (Sandbox Code Playgroud)
//index.ts
import {MyInterface} from './types/mytypes.ts';
const my_main_name = {
myfunc: function(param1:MyInterface):void{
console.log(param1.a);
}
}
Run Code Online (Sandbox Code Playgroud)
我通过设置tsconfig.jsonparam生成声明文件"declaration":"true"。
现在我想使用这个库作为另一个库的依赖。
mylib
yrlib
???src
? ???index.ts
???package.json
???tsconfig.json
Run Code Online (Sandbox Code Playgroud)
//mytypes.ts
export interface MyInterface {
a:string
}
Run Code Online (Sandbox Code Playgroud)
mylib
yrlib
???src
? ???index.ts
???package.json
???tsconfig.json
Run Code Online (Sandbox Code Playgroud)
mylib因为它是导出的,所以我得到了自动完成。
我的问题是如何查看mylib模块内部的所有类型和接口yrlib?
因为它们可以是数百个并且位于所有不同的文件和文件夹中。
我应该一一导出所有这些吗?最佳做法是什么?有没有办法一次导出所有类型?
而如何"typying":"dist/index.d.ts"在package.json这一切发作?应该是一个文件中的所有类型吗?为什么 Typescript 不生成这个文件? …