forked from CnCNet/cncnet-docker-dotnetcore-tunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
63 lines (50 loc) · 1.83 KB
/
dockerfile
File metadata and controls
63 lines (50 loc) · 1.83 KB
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
# Ubuntu base image
FROM ubuntu:latest
# Avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# Install prerequisites and .NET 9 from dotnet backports
RUN apt-get update && \
apt-get install -y software-properties-common wget unzip libssl-dev ca-certificates && \
add-apt-repository ppa:dotnet/backports -y && \
apt-get update && \
apt-get install -y \
dotnet-sdk-10.0 \
aspnetcore-runtime-10.0 \
dotnet-runtime-10.0 && \
rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN groupadd -r cncnet && \
useradd -r -g cncnet -d /app -s /sbin/nologin cncnet
# Working directory
WORKDIR /app
# Repo details
ARG OWNER=Rans4ckeR
ARG REPO=cncnet-server
ARG BASE_URL=https://github.com/${OWNER}/${REPO}/releases/download
# Last known .NET 10 compatible release
ARG VERSION=v4.0.33
# Download EXACT asset by architecture
ARG ARCH=x86_64
RUN if [ "$ARCH" = "x86_64" ]; then \
URL="https://github.com/Rans4ckeR/cncnet-server/releases/download/v4.0.33/cncnet-server-v4.0.33-net10.0-V2+V3-linux-x64.zip"; \
else \
URL="https://github.com/Rans4ckeR/cncnet-server/releases/download/v4.0.33/cncnet-server-v4.0.33-net10.0-V2+V3-linux-arm64.zip"; \
fi && \
wget "$URL" -O /tmp/cncnet.zip && \
unzip /tmp/cncnet.zip -d /app && \
rm /tmp/cncnet.zip && \
chmod +x /app/cncnet-server
# Permissions and logs
RUN chmod +x /app/cncnet-server && \
mkdir -p /logs && \
chown -R cncnet:cncnet /app /logs
# Drop privileges
USER cncnet
# Expose ports
EXPOSE 50000/tcp 50000/udp 50001/tcp 50001/udp 8054/udp 3478/udp
# Default environment variables
ENV SERVER_NAME="My CnCNet tunnel"
ENV PORT1=50001
ENV PORT2=50000
# Run the tunnel and tee logs
CMD ["sh", "-c", "/app/cncnet-server --name \"${SERVER_NAME}\" --2 --3 --m 200 --p ${PORT1} --p2 ${PORT2} 2>&1 | tee /logs/cncnet-server.log"]