-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
202 additions
and
0 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
[package] | ||
name = "learn" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
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,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |
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 @@ | ||
{"rustc_fingerprint":8968926148183509743,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.62.0-nightly (69a5d2481 2022-04-27)\nbinary: rustc\ncommit-hash: 69a5d2481e856a5a18885390b8cf6950b9ff8dd3\ncommit-date: 2022-04-27\nhost: aarch64-apple-darwin\nrelease: 1.62.0-nightly\nLLVM version: 14.0.1\n","stderr":""},"15697416045686424142":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""},"10376369925670944939":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/ajun/.rustup/toolchains/nightly-aarch64-apple-darwin\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"llvm14-builtins-abi\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"v8.1a\"\ntarget_feature=\"v8.2a\"\ntarget_feature=\"v8.3a\"\ntarget_feature=\"v8.4a\"\ntarget_feature=\"vh\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"128\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}} |
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,3 @@ | ||
Signature: 8a477f597d28d172789f06886806bc55 | ||
# This file is a cache directory tag created by cargo. | ||
# For information about cache directory tags see https://bford.info/cachedir/ |
Empty file.
1 change: 1 addition & 0 deletions
1
learn-rust/learn/target/debug/.fingerprint/learn-e926fff52fc12343/bin-learn
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 @@ | ||
7dc4d38f67ba849c |
1 change: 1 addition & 0 deletions
1
learn-rust/learn/target/debug/.fingerprint/learn-e926fff52fc12343/bin-learn.json
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 @@ | ||
{"rustc":837929224129467038,"features":"[]","target":10353110337280111280,"profile":11736316127369858332,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/learn-e926fff52fc12343/dep-bin-learn"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0} |
Binary file added
BIN
+24 Bytes
learn-rust/learn/target/debug/.fingerprint/learn-e926fff52fc12343/dep-bin-learn
Binary file not shown.
1 change: 1 addition & 0 deletions
1
learn-rust/learn/target/debug/.fingerprint/learn-e926fff52fc12343/invoked.timestamp
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 @@ | ||
This file has an mtime of when this was started. |
Binary file not shown.
Binary file added
BIN
+4.66 KB
learn-rust/learn/target/debug/deps/learn-e926fff52fc12343.1208v6c2i1vgjozl.rcgu.o
Binary file not shown.
Binary file added
BIN
+2.97 KB
learn-rust/learn/target/debug/deps/learn-e926fff52fc12343.1dnm3cx3x6538scp.rcgu.o
Binary file not shown.
Binary file added
BIN
+2.73 KB
learn-rust/learn/target/debug/deps/learn-e926fff52fc12343.218sfjybf45qehty.rcgu.o
Binary file not shown.
Binary file added
BIN
+6.23 KB
learn-rust/learn/target/debug/deps/learn-e926fff52fc12343.2exk9dm1qa8aagdi.rcgu.o
Binary file not shown.
Binary file added
BIN
+2.64 KB
learn-rust/learn/target/debug/deps/learn-e926fff52fc12343.3so82y074islq4t6.rcgu.o
Binary file not shown.
Binary file added
BIN
+2.2 KB
learn-rust/learn/target/debug/deps/learn-e926fff52fc12343.43ejiykgagh9zpob.rcgu.o
Binary file not shown.
Binary file added
BIN
+3.58 KB
learn-rust/learn/target/debug/deps/learn-e926fff52fc12343.44hmmqbjc4ukogv4.rcgu.o
Binary file not shown.
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,5 @@ | ||
/Users/ajun/Desktop/study/ajunge-docs/learn-rust/learn/target/debug/deps/learn-e926fff52fc12343: src/main.rs | ||
|
||
/Users/ajun/Desktop/study/ajunge-docs/learn-rust/learn/target/debug/deps/learn-e926fff52fc12343.d: src/main.rs | ||
|
||
src/main.rs: |
Binary file added
BIN
+4.6 KB
learn-rust/learn/target/debug/deps/learn-e926fff52fc12343.ddffov709tyqs0t.rcgu.o
Binary file not shown.
Binary file added
BIN
+4.66 KB
...ebug/incremental/learn-1v1zpk22wmo67/s-g9wxwvv24l-1fsgr6-2s8hgq7tjglpq/1208v6c2i1vgjozl.o
Binary file not shown.
Binary file added
BIN
+2.97 KB
...ebug/incremental/learn-1v1zpk22wmo67/s-g9wxwvv24l-1fsgr6-2s8hgq7tjglpq/1dnm3cx3x6538scp.o
Binary file not shown.
Binary file added
BIN
+2.73 KB
...ebug/incremental/learn-1v1zpk22wmo67/s-g9wxwvv24l-1fsgr6-2s8hgq7tjglpq/218sfjybf45qehty.o
Binary file not shown.
Binary file added
BIN
+6.23 KB
...ebug/incremental/learn-1v1zpk22wmo67/s-g9wxwvv24l-1fsgr6-2s8hgq7tjglpq/2exk9dm1qa8aagdi.o
Binary file not shown.
Binary file added
BIN
+2.64 KB
...ebug/incremental/learn-1v1zpk22wmo67/s-g9wxwvv24l-1fsgr6-2s8hgq7tjglpq/3so82y074islq4t6.o
Binary file not shown.
Binary file added
BIN
+2.2 KB
...ebug/incremental/learn-1v1zpk22wmo67/s-g9wxwvv24l-1fsgr6-2s8hgq7tjglpq/43ejiykgagh9zpob.o
Binary file not shown.
Binary file added
BIN
+3.58 KB
...ebug/incremental/learn-1v1zpk22wmo67/s-g9wxwvv24l-1fsgr6-2s8hgq7tjglpq/44hmmqbjc4ukogv4.o
Binary file not shown.
Binary file added
BIN
+4.6 KB
...debug/incremental/learn-1v1zpk22wmo67/s-g9wxwvv24l-1fsgr6-2s8hgq7tjglpq/ddffov709tyqs0t.o
Binary file not shown.
Binary file added
BIN
+79 KB
...get/debug/incremental/learn-1v1zpk22wmo67/s-g9wxwvv24l-1fsgr6-2s8hgq7tjglpq/dep-graph.bin
Binary file not shown.
Binary file added
BIN
+23.1 KB
...t/debug/incremental/learn-1v1zpk22wmo67/s-g9wxwvv24l-1fsgr6-2s8hgq7tjglpq/query-cache.bin
Binary file not shown.
Binary file added
BIN
+483 Bytes
...debug/incremental/learn-1v1zpk22wmo67/s-g9wxwvv24l-1fsgr6-2s8hgq7tjglpq/work-products.bin
Binary file not shown.
Empty file.
Binary file not shown.
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 @@ | ||
/Users/ajun/Desktop/study/ajunge-docs/learn-rust/learn/target/debug/learn: /Users/ajun/Desktop/study/ajunge-docs/learn-rust/learn/src/main.rs |
Binary file not shown.
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,33 @@ | ||
/** | ||
* 所有权问题 | ||
*/ | ||
|
||
// fn main() { | ||
// let a = "hello"; | ||
// let b = "hello".to_string(); | ||
// let c = a; | ||
// println!("{:?}", a); | ||
// let c = b; | ||
// println!("{:?}", b); | ||
// // ^ value borrowed here after move | ||
// } | ||
|
||
|
||
/** | ||
* 借用的概念 | ||
*/ | ||
|
||
// fn main() { | ||
// let a = [1, 2, 3]; | ||
// let b = &a; | ||
// println!("{:p}", b); // 0x16fd1f14c | ||
// // 可变绑定 | ||
// let mut c = vec![1, 2, 3]; | ||
// // &mut 是可变引用,要想可变引用,在绑定的时候也必须是可变 | ||
// let d = &mut c; // c 和 d 是同一个内存地址 | ||
// d.push(4); | ||
// println!("{:?}", d); // [1, 2, 3, 4] | ||
// println!("{:?}", c); // [1, 2, 3, 4] | ||
// let e = &42; | ||
// assert_eq!(42, *e) | ||
// } |
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,120 @@ | ||
## 进入一个正在运行的docker的终端 | ||
|
||
---- | ||
|
||
## 运行docker基本流程 | ||
docker run -it -p [服务器的端口]:[docker虚拟机的端口] 镜像名称 | ||
|
||
举例: | ||
|
||
`docker run -it -p 80:80 nginx-html` | ||
|
||
由于Nginx默认是在80端口,所以docker虚拟机端口选择80 | ||
如果要访问 https://服务器ip:3000 访问到文件 | ||
那么就需要输入 `docker run -it -p 3000:80 nginx-html` | ||
|
||
|
||
nginx-html是自己打的镜像 | ||
|
||
打镜像过程 | ||
```shell | ||
mkdir test-single-index | ||
cd test-single-index | ||
vim index.html | ||
vim Dockerfile | ||
docker image build -t nginx-html . | ||
# 这里默认打的使用 Dockerfile这个文件,如果指定文件可以通过 -f 来指定 | ||
# docker image build -f node.Dockerfile -t tag-name | ||
``` | ||
|
||
|
||
运行 | ||
|
||
docker run -it -p 80:80 nginx-html | ||
|
||
通过这样的流程 可以打包一个只有index.html的最基础Nginx包 | ||
|
||
上述Dockerfile内容为 | ||
|
||
```Dockerfile | ||
# 选择基础镜像 | ||
FROM nginx:1.21.0-alpine | ||
|
||
# 将上面写的index.html打入到镜像的 Nginx默认目录 | ||
# 由于还没有对Nginx进行配置,所以默认进入到这个页面中 | ||
ADD index.html /usr/share/nginx/html/index.html | ||
``` | ||
|
||
|
||
### RUN 指令 | ||
|
||
RUN 可以在镜像中执行shell脚本(包括异步,比如下载、删除等操作) | ||
|
||
但是一个RUN指令会产生一层 **Image Layer** (不知道是什么) 会让镜像变得很大 | ||
所以在一个RUN指令里面使用 && 和 换行就可以 | ||
```Dockerfile | ||
FROM what | ||
RUN echo "Hello" && \ | ||
echo "World" && \ | ||
echo "!" | ||
``` | ||
|
||
### 为什么说多次RUN有缓存? | ||
我的理解是 它类似git一样,每次的RUN都需要保存 | ||
所以如果有下载文件的话,当次的历史记录也会继续把文件保留 | ||
下一次RUN的时候才删除。但是文件依然存在于版本管理的东西内 | ||
所以会比较占空间 | ||
|
||
## Dockerfile中的COPY | ||
COPY和ADD都可以把本地的文件复制到镜像。如果嵌套目录不存在,会自动创建 | ||
|
||
|
||
```Dockerfile | ||
COPY my-file.js /a/b/c/index.js | ||
``` | ||
|
||
|
||
### ADD和COPY的不同点 | ||
如果是压缩文件的话,ADD后可以自动解压 | ||
|
||
|
||
### 如何选择 | ||
|
||
复制一般使用`COPY`,解压使用`ADD` | ||
|
||
## WORKDIR | ||
WORKDIR 是指定了当前的工作目录(如果没有就创建) | ||
在指定了工作目录后运行的ADD、COPY等命令,都会默认在工作目录中新建和复制 | ||
(相当于是cd到了那个目录再进行操作) | ||
|
||
|
||
## ARG和ENV | ||
|
||
相同点: | ||
在Dockerfile中,同样可以当做变量来使用 | ||
```Dockerfile | ||
FROM node:14 | ||
ARG NAME=Hello | ||
ENV AGE=18 | ||
``` | ||
|
||
不同点: | ||
ARG灵活,在构建容器的时候可以通过 --build-arg NAME=newName 来改变变量 | ||
而不是通过修改Dockerfile | ||
ENV可以打入到虚拟环境中的env里面 | ||
|
||
|
||
## CMD | ||
CMD就是最后一次执行的命令 | ||
或者说是 容器启动的时候执行的命令 | ||
多个CMD的的话,只会执行最后一个 | ||
|
||
|
||
|
||
## 快速清理 | ||
|
||
快速清理停止的容器 | ||
`docker system prune -f` | ||
|
||
快速清理没有使用的镜像 | ||
`docker image prune -a` |