Spaces:
Paused
Paused
File size: 1,402 Bytes
83607bc 44cd6bb 83607bc 4b326a2 cce47b9 8ebbced cce47b9 da8769d cce47b9 fc28fd3 1a0b523 cce47b9 a5c604e cce47b9 1a0b523 cce47b9 fc28fd3 9570789 fc28fd3 83607bc 633bdf8 fc28fd3 83607bc 090b129 a97d8f8 57ff546 a97d8f8 83607bc a97d8f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# Use an official Ubuntu runtime as a parent image
FROM ubuntu:latest
# 设置非交互式环境变量,以避免 tzdata 安装时的交互
ENV DEBIAN_FRONTEND=noninteractive
# Use Aliyun mirrors for apt-get
RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirrors.aliyun.com\/ubuntu\//g' /etc/apt/sources.list
# Update the package lists
RUN apt-get update
# Install build tools
RUN apt-get install -y g++ make cmake autoconf automake libtool
# 安装 spdlog 依赖
RUN apt-get install -y \
libfmt-dev
# Download and build libhv from source
RUN apt-get install -y git
RUN git clone https://github.com/ithewei/libhv.git /usr/src/libhv
WORKDIR /usr/src/libhv
RUN make
RUN make install
# Add the libhv library path
RUN ldconfig
# 克隆 spdlog 仓库
RUN git clone https://github.com/gabime/spdlog.git /usr/src/spdlog
WORKDIR /usr/src/spdlog
# 运行 CMake 配置
RUN cmake .
# 运行构建
RUN make
# 运行安装
RUN make install
RUN ldconfig
# Set the working directory to /app
WORKDIR /app
# Copy the source code into the container
COPY . .
RUN apt-get install -y tzdata
# 设置时区为 Asia/Shanghai
ENV TZ=Asia/Shanghai
RUN dpkg-reconfigure --frontend noninteractive tzdata
# Compile the C++ program
RUN g++ -std=c++14 -g -o proxyServer src/*.cpp main.cpp -I include -lhv -lspdlog
EXPOSE 8080
# Run my_program when the container launches
CMD ["./proxyServer"]
|