容器化
This commit is contained in:
11
.dockerignore
Normal file
11
.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
data
|
||||||
|
mem_leak
|
||||||
|
*.o
|
||||||
|
kvstore
|
||||||
|
test-redis/testcase
|
||||||
|
test-redis/bench
|
||||||
|
libbpf-bootstrap
|
||||||
|
ebpf
|
||||||
|
img
|
||||||
47
Dockerfile
Normal file
47
Dockerfile
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
ARG UBUNTU_VERSION=22.04
|
||||||
|
ARG APT_MIRROR=mirrors.aliyun.com
|
||||||
|
|
||||||
|
FROM ubuntu:${UBUNTU_VERSION} AS builder
|
||||||
|
|
||||||
|
ARG APT_MIRROR
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN sed -i "s|http://archive.ubuntu.com/ubuntu/|http://${APT_MIRROR}/ubuntu/|g; s|http://security.ubuntu.com/ubuntu/|http://${APT_MIRROR}/ubuntu/|g" /etc/apt/sources.list \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
ca-certificates \
|
||||||
|
libhiredis-dev \
|
||||||
|
liburing-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN make kvstore CFLAGS="-g -D_DEFAULT_SOURCE -DJEMALLOC_NO_DEMANGLE"
|
||||||
|
|
||||||
|
FROM ubuntu:${UBUNTU_VERSION}
|
||||||
|
|
||||||
|
ARG APT_MIRROR
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN sed -i "s|http://archive.ubuntu.com/ubuntu/|http://${APT_MIRROR}/ubuntu/|g; s|http://security.ubuntu.com/ubuntu/|http://${APT_MIRROR}/ubuntu/|g" /etc/apt/sources.list \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates \
|
||||||
|
liburing2 \
|
||||||
|
libxml2 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/kvstore /app/kvstore
|
||||||
|
|
||||||
|
RUN mkdir -p /app/config /app/data
|
||||||
|
|
||||||
|
EXPOSE 8888
|
||||||
|
VOLUME ["/app/data"]
|
||||||
|
|
||||||
|
CMD ["./kvstore"]
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<config>
|
<config>
|
||||||
<server>
|
<server>
|
||||||
<ip>127.0.0.1</ip>
|
<ip>0.0.0.0</ip>
|
||||||
<port>8888</port>
|
<port>8888</port>
|
||||||
<mode>master</mode>
|
<mode>master</mode>
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</log>
|
</log>
|
||||||
|
|
||||||
<persistence>
|
<persistence>
|
||||||
<type>none</type>
|
<type>incremental</type>
|
||||||
<dir>data</dir>
|
<dir>data</dir>
|
||||||
|
|
||||||
<wal>kvs_oplog.db</wal>
|
<wal>kvs_oplog.db</wal>
|
||||||
|
|||||||
16
docker-compose.yml
Normal file
16
docker-compose.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
services:
|
||||||
|
kvstore:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
APT_MIRROR: ${APT_MIRROR:-mirrors.aliyun.com}
|
||||||
|
image: kvstore:single
|
||||||
|
container_name: kvstore
|
||||||
|
restart: unless-stopped
|
||||||
|
security_opt:
|
||||||
|
- seccomp=unconfined
|
||||||
|
ports:
|
||||||
|
- "8888:8888"
|
||||||
|
volumes:
|
||||||
|
- ./config/config.xml:/app/config/config.xml:ro
|
||||||
|
- ./data:/app/data
|
||||||
Reference in New Issue
Block a user