容器化
This commit is contained in:
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"]
|
||||
Reference in New Issue
Block a user