-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdockerfile-dotnet9
47 lines (37 loc) · 1.54 KB
/
dockerfile-dotnet9
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
# Start with the Ubuntu base image
FROM ubuntu:latest
# Install Common Software Properties
RUN apt-get update && \
apt-get install -y software-properties-common
# Add extra repository for backports
RUN add-apt-repository ppa:dotnet/backports -y
# Update and install necessary packages
RUN apt-get update && \
apt-get install -y wget tar unzip dotnet-sdk-9.0 aspnetcore-runtime-9.0 dotnet-runtime-9.0 libssl-dev && \
rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Set the version and base URL
ARG VERSION=v4.0.24
ARG BASE_URL=https://github.com/Rans4ckeR/cncnet-server/releases/download/${VERSION}/
# Detect the architecture
RUN ARCH=$(uname -m) && \
case "$ARCH" in \
x86_64) \
FILE=cncnet-server-${VERSION}-net9.0-V2+V3-linux-x64.zip ;; \
aarch64) \
FILE=cncnet-server-${VERSION}-net9.0-V2+V3-linux-arm64.zip ;; \
*) \
echo "Unsupported architecture: $ARCH" && exit 1 ;; \
esac && \
wget ${BASE_URL}${FILE} -O /tmp/cncnet-server.zip && \
unzip /tmp/cncnet-server.zip -d /app && \
rm /tmp/cncnet-server.zip
# Change permissions to make cncnet-server executable
RUN chmod +x /app/cncnet-server
# Ensure the /logs directory exists
RUN mkdir -p /logs
# Expose the required ports
EXPOSE 50000/tcp 50000/udp 50001/tcp 50001/udp 8054/udp 3478/udp
# Start the tunnel server when the container launches
CMD /app/cncnet-server --name "My CnCNet tunnel" --2 --3 --m 200 --p 50001 --p2 50000 > /logs/cncnet-server.log 2>&1 && tail -f /logs/cncnet-server.log