forked from v2fly/v2ray-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (31 loc) · 1.21 KB
/
Dockerfile
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
############################
# STEP 1: Build executable binary
############################
FROM golang:alpine AS builder
# Install dependencies
RUN apk update && apk add --no-cache git bash wget curl
# Set working directory
WORKDIR /build
# Clone the repository and build V2Ray
RUN git clone --progress https://github.com/v2fly/v2ray-core.git . && \
bash ./release/user-package.sh nosource noconf codename=$(git describe --abbrev=0 --tags) buildname=docker-fly abpathtgz=/tmp/v2ray.tgz
############################
# STEP 2: Build a small image
############################
FROM alpine
# Set the maintainer label
LABEL maintainer="V2Fly Community <[email protected]>"
# Copy the V2Ray package from the builder stage
COPY --from=builder /tmp/v2ray.tgz /tmp
# Install CA certificates and extract V2Ray
RUN apk update && apk add --no-cache ca-certificates tzdata && \
mkdir -p /usr/bin/v2ray && \
tar xvfz /tmp/v2ray.tgz -C /usr/bin/v2ray && \
rm /tmp/v2ray.tgz # Clean up to save space
# Set up the volume for configuration
VOLUME ["/etc/v2ray"]
# Set environment variables
ENV TZ="Asia/Shanghai"
# Set the entry point and command
ENTRYPOINT ["/usr/bin/v2ray/v2ray"]
CMD ["run", "-config", "/etc/v2ray/config.json"]