个人Dockerfile分享

nginx

复制代码
[root@docker docker]# cat Dockerfile 
FROM nginx:1.20.1-alpine
COPY /dist  /usr/local/web/
COPY nginx.conf /etc/nginx/nginx.conf
CMD ["nginx", "-g", "daemon off;"]

user nginx;

worker_processes auto;

error_log /var/log/nginx/error.log notice;

pid /var/run/nginx.pid;

events {

worker_connections 1024;

}

http {

include /etc/nginx/mime.types;

default_type application/octet-stream;

log_format main '$remote_addr - r e m o t e u s e r [ remote_user [ remoteuser[time_local] "KaTeX parse error: Double superscript at position 32: ... '̲status b o d y b y t e s s e n t " body_bytes_sent " bodybytessent"http_referer" '

'" h t t p u s e r a g e n t " " http_user_agent" " httpuseragent""http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;

keepalive_timeout 65;

server {

listen 80;

server_name localhost;

real_ip_header X-Real-IP;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

复制代码
location / {
  root   /usr/local/web;
  index  index.html;
  try_files $uri $uri/ /index.html;
}
error_page   500 502 503 504  /50x.html;
location = /50x.html {
  root   /usr/share/nginx/html;
}

}

}

centos

复制代码
FROM centos:centos7.9.2009

ENV LC_ALL="en_US.utf8"

RUN yum install -y wget &&

rm -rf /etc/yum.repos.d/* &&

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo &&

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo &&

yum update -y &&

yum install -y telnet net-tools vim &&

yum clean all &&

rm -rf /tmp/* rm -rf /var/cache/yum/* &&

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime &&

echo "Asia/Shanghai" > /etc/timezone

CMD ["/bin/bash"]

java

复制代码
FROM anapsix/alpine-java:8u202b08_jdk

RUN echo 'http://mirrors.ustc.edu.cn/alpine/v3.5/main' > /etc/apk/repositories

&& echo 'http://mirrors.ustc.edu.cn/alpine/v3.5/community' >>/etc/apk/repositories

&& apk update && apk add tzdata

&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \

&& echo "Asia/Shanghai" > /etc/timezones

CMD ["/bin/bash"]

rocksdb

复制代码
FROM centos:centos7

USER root

ADD go1.17.linux-amd64.tar.gz /usr/local/

ADD cmake-3.6.0-Linux-x86_64.tar.gz /data

ADD gflags-2.2.2.tar.gz /data

ADD rocksdb-6.4.6.tar.gz /data

ADD zstd-1.1.3.tar.gz /data

RUN yum install -y gcc gcc-c++ lrzsz git lz4-devel snappy snappy-devel zlib zlib-devel bzip2 bzip2-devel lz4 lz4-devel &&

cd /data &&

yum remove cmake &&

echo "export PATH=$PATH:/data/cmake-3.6.0-Linux-x86_64/bin" >> /etc/profile &&

source /etc/profile &&

echo "export GOROOT=/usr/local/go" >> /etc/profile &&

echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile &&

source /etc/profile &&

cd /data/gflags-2.2.2 && mkdir build && cd build &&

cmake -DBUILD_SHARED_LIBS=ON -DBUILD_STATICaaa_LIBS=ON -DINSTALL_HEADERS=ON -DINSTALL_SHARED_LIBS=ON -DINSTALL_STATIC_LIBS=ON ... &&

make -j 5 && make install &&

echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" >> /etc/profile &&

cd /data/zstd-1.1.3 &&

make -j 5 && make install &&

cd /data/rocksdb-6.4.6 &&

make -j 5 static_lib &&

make -j 5 shared_lib &&

cp librocksdb.so.6.4.6 /usr/local/lib &&

ln -s librocksdb.so.6.4.6 /usr/local/lib/librocksdb.so.6.4 &&

ln -s librocksdb.so.6.4.6 /usr/local/lib/librocksdb.so.6 &&

ln -s librocksdb.so.6.4.6 /usr/local/lib/librocksdb.so &&

echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" >> /etc/profile &&

source /etc/profile

CMD tail -f /etc/hosts

#!/bin/bash

rocksdb_datadir=/data/rocksdbTemp

mkdir -p ${rocksdb_datadir}

cd /data

cat > rocksdbtest.cpp << EOF

#include

#include

#include "rocksdb/db.h"

#include "rocksdb/slice.h"

#include "rocksdb/options.h"

using namespace std;

using namespace rocksdb;

const std::string PATH = "${rocksdb_datadir}"; //rocksDB的数据存储目录绝对路径

int main(){

DB* db;

Options options;

options.create_if_missing = true;

Status status = DB::Open(options, PATH, &db);

assert(status.ok());

Slice key("test01");

Slice value("success");

复制代码
std::string get_value;
status = db->Put(WriteOptions(), key, value);
if(status.ok()){
    status = db->Get(ReadOptions(), key, &get_value);
    if(status.ok()){
        printf("value is %s\n", get_value.c_str());
    }else{
        printf("get failed\n"); 
    }
}else{
    printf("put failed\n");
}

delete db;

}

EOF

g++ -std=c++11 -o rocksdbtest2 rocksdbtest.cpp -I /data/rocksdb-6.4.6/include -L/data/rocksdb-6.4.6 -lrocksdb -ldl

./rocksdbtest2

相关推荐
东方芷兰39 分钟前
LLM 笔记 —— 01 大型语言模型修炼史(Self-supervised Learning、Supervised Learning、RLHF)
人工智能·笔记·神经网络·语言模型·自然语言处理·transformer
腾飞开源42 分钟前
02_钉钉消息处理流程设计
人工智能·钉钉·agent智能体·ai智能体开发·全网首发·新课上线·消息处理器
-雷阵雨-42 分钟前
数据结构——LinkedList和链表
java·开发语言·数据结构·链表·intellij-idea
K24B;44 分钟前
多模态大语言模型OISA
人工智能·语言模型·语音识别·分割·多模态大语言模型
K24B;44 分钟前
多模态大语言模型LISA
人工智能·语言模型·分割·多模态大语言模型
小*-^-*九2 小时前
Electron vue项目 打包 exe文件
javascript·vue.js·electron
大飞pkz4 小时前
【设计模式】责任链模式
开发语言·设计模式·c#·责任链模式
AI视觉网奇4 小时前
rknn yolo11 推理
前端·人工智能·python
gplitems1234 小时前
Gunslinger – Gun Store & Hunting WordPress Theme: A Responsible
开发语言·前端·javascript
AI数据皮皮侠5 小时前
中国各省森林覆盖率等数据(2000-2023年)
大数据·人工智能·python·深度学习·机器学习