0%

项目开发过程中,会遇到本地配置文件每个开发人员不同的情况,但如果遇到类似数据库配置这种最终需要加入 git 版本控制的配置,则会陷入两难境地。要么不跟踪,要么有人提交后其他人同步下来必须手动修改,非常麻烦。其实,对于已被纳入版本管理的文件,git 也提供了很好的解决办法。

1
2
3
4
5
6
7
8
# 告诉git忽略对已经纳入版本管理的文件 .classpath 的修改,git 会一直忽略此文件直到重新告诉 git 可以再次跟踪此文件
$ git update-index --assume-unchanged .classpath

# 告诉 git 恢复跟踪
$ git update-index --no-assume-unchanged .classpath

# 查看当前被忽略的、已经纳入版本库管理的文件:
$ git ls-files -v | grep -e "^[hsmrck]"

Git Bash command window insert below code:

1
2
3
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding utf-8
export LESSCHARSET=utf-8

access github slow

140.82.113.4 github.com
199.232.69.194 github.global.ssl.fastly.net

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
version: '3'
services:
test-boot:
build:
context: ./
dockerfile: ./Dockerfile
image: gzxu/test-boot
container_name: gzxu-tb
restart: always
ports:
- 8080:8080

下面是Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# VERSION 0.0.1

FROM java:8

MAINTAINER guozhong.xu@qq.com

# VOLUME 指定了临时文件目录为/tmp。
# 其效果是在主机 /var/lib/docker 目录下创建了一个临时文件,并链接到容器的/tm
VOLUME /tmp

# 将jar包添加到容器中并更名为app.jar
COPY test-0331-boot-0.0.1-SNAPSHOT.jar app.jar

RUN bash -c "touch /app.jar"

EXPOSE 8080

# 为了缩短 Tomcat 的启动时间,添加java.security.egd的系统属性指向/dev/urandom
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]




docker build -t gzxu/test-boot .
docker run -d -p 8080:8080 --name tb gzxu/test-boot
docker rmi -f id

# 保存包含依赖的镜像
docker save > test-boot.tar gzxu/test-boot
# -o:指定保存的镜像的名字;test-boot.tar:保存到本地的镜像名称;gzxu/test-boot。

# 载入镜像
docker load < test-boot.tar

yum -y install openssl openssl-devel ncurses-devel.x86_64 bzip2-devel sqlite-devel python-devel zlib
yum install -y epel-release && yum install -y python-pip && pip install --upgrade pip && pip install docker-compose

docker-compose version

docker-compose up -d