Skip to content

Commit

Permalink
推送docker部署方案
Browse files Browse the repository at this point in the history
  • Loading branch information
ss1917 committed Aug 14, 2019
1 parent 83031ce commit fc46303
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
32 changes: 9 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
FROM centos:7
# 设置编码
ENV LANG en_US.UTF-8
# 同步时间
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
FROM registry.cn-hangzhou.aliyuncs.com/ss1917/codo-node:v10.16.1

# 1. 安装基本依赖和nginx
RUN yum update -y && yum install epel-release -y && yum update -y && yum install wget nginx git -y
WORKDIR /app

# 2. 准备node
RUN wget -q -c https://npm.taobao.org/mirrors/node/v10.16.1/node-v10.16.1-linux-x64.tar.xz && tar xf node-v10.16.1-linux-x64.tar.xz -C /usr/local/
RUN rm -rf /usr/local/bin/node && rm -rf /usr/local/bin/npm \
&& ln -s /usr/local/node-v10.16.1-linux-x64/bin/node /usr/local/bin/node \
&& ln -s /usr/local/node-v10.16.1-linux-x64/bin/node /usr/bin/node \
&& ln -s /usr/local/node-v10.16.1-linux-x64/bin/npm /usr/local/bin/npm \
&& ln -s /usr/local/node-v10.16.1-linux-x64/bin/npm /usr/bin/npm
MAINTAINER "shenshuo<[email protected]>"

# 4. 复制代码
# 复制代码
RUN mkdir -p /app
WORKDIR /app
ADD . /app

RUN rm -rf /app/node_modules && npm config set registry https://registry.npmjs.org/ \
&& npm cache clean --force \
&& npm install --ignore-script \
&& npm cache clean --force \
&& npm install --ignore-script \
&& npm run build \
&& mkdir -p /var/www/codo && cp -r /app/dist/* /var/www/codo/

# 5. 日志
VOLUME /var/log/
VOLUME /var/log/nginx/

# 6. 准备文件
COPY nginx_ops.conf /etc/nginx/conf.d/default.conf
# 6. 准备文件 请注意如果要修改访问的域名,请在编译之前修改nginx_ops.conf 的server_name
# COPY nginx_ops.conf /etc/nginx/conf.d/default.conf

# 开放端口
EXPOSE 80
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
codo:
restart: unless-stopped
image: codo_image
volumes:
- /var/log/nginx/:/var/log/nginx/
- /my/nginx/:/etc/nginx/
- /sys/fs/cgroup:/sys/fs/cgroup
ports:
- "80:80"
- "443:443"
4 changes: 2 additions & 2 deletions nginx_ops.conf
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ server {
error_log /var/log/nginx/codo-error.log;
ssl on;
index index.html index.htm;
ssl_certificate /etc/nginx/opendevops.crt;
ssl_certificate_key /etc/nginx/opendevops.key;
ssl_certificate /etc/nginx/key/opendevops.crt;
ssl_certificate_key /etc/nginx/key/opendevops.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:ECDHE-RSA-AES128-SHA256:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!DSS:!PKS;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
Expand Down

0 comments on commit fc46303

Please sign in to comment.