Commit 4ce384aa by Tang

feat: 打包镜像

parent 2e72bbdc
FROM nginx
RUN rm -rf /usr/share/nginx/html/*
RUN rm -rf /etc/nginx/conf.d/*
COPY dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["sh","/usr/local/bin/docker-entrypoint.sh"]
#!/bin/bash
REGISTRY_URL="registry.cn-hangzhou.aliyuncs.com"
NAME_SPACE="ksami"
BUILD_TAG="1.0"
IMAGE_NAME="gs1cn_front"
if [ "$1" != "" ];
then
BUILD_TAG="$1"
fi
REGISTRY_URL="registry.cn-hangzhou.aliyuncs.com"
docker login --username=$DOCKER_REPO_USERNAME $REGISTRY_URL --password=$DOCKER_REPO_PASSWORD
set -e
docker build -t $IMAGE_NAME:$BUILD_TAG .
docker tag $IMAGE_NAME:$BUILD_TAG $REGISTRY_URL/$NAME_SPACE/$IMAGE_NAME:$BUILD_TAG
docker push $REGISTRY_URL/$NAME_SPACE/$IMAGE_NAME:$BUILD_TAG
docker rmi $IMAGE_NAME:$BUILD_TAG
docker rmi $REGISTRY_URL/$NAME_SPACE/$IMAGE_NAME:$BUILD_TAG
#!/bin/sh
chmod -R 777 /usr/share/nginx/html
nginx -g 'daemon off;'
# 开启gzip
gzip on;
# 启用gzip压缩的最小文件,小于设置值的文件将不会压缩
gzip_min_length 1k;
# gzip 压缩级别,1-10,数字越大压缩的越好,也越占用CPU时间,后面会有详细说明
gzip_comp_level 5;
# 进行压缩的文件类型。javascript有多种形式。其中的值可以在 mime.types 文件中找到。
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png font/ttf font/otf image/svg+xml;
# 是否在http header中添加Vary: Accept-Encoding,建议开启
gzip_vary on;
# 禁用IE 6 gzip
gzip_disable "MSIE [1-6]\.";
server {
listen 8088;
server_name 81.68.189.225;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.*) /index.html last;
break;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment