File size: 1,076 Bytes
fde13cc
fffb79c
3bc5ae9
585c2f2
fde13cc
 
 
 
 
 
 
 
 
 
 
585c2f2
 
fde13cc
585c2f2
4225d7a
585c2f2
 
 
 
 
 
fde13cc
585c2f2
 
3bc5ae9
585c2f2
3bc5ae9
 
 
fde13cc
585c2f2
 
 
 
 
 
 
 
3bc5ae9
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
# Build stage
FROM golang:1.26-alpine AS builder

WORKDIR /app

# Install git and patch
RUN apk add --no-cache git patch

# Clone the upstream repository
RUN git clone https://github.com/Router-for-me/CLIProxyAPI .

# Copy and apply the verification fix patch
COPY auth_fix.patch .
RUN patch -p1 < auth_fix.patch

# Download dependencies
RUN go mod download

# Build the application
RUN go build -o CLIProxyAPI cmd/server/main.go

# Final stage
FROM alpine:latest

WORKDIR /CLIProxyAPI

# Copy binary and config from builder
COPY --from=builder /app/CLIProxyAPI /CLIProxyAPI/CLIProxyAPI
COPY --from=builder /app/config.example.yaml /CLIProxyAPI/config.example.yaml

# Copy local config and entrypoint
COPY config.yaml /CLIProxyAPI/config.yaml
COPY entrypoint.sh /CLIProxyAPI/entrypoint.sh

# Create necessary directories and set permissions
RUN mkdir -p /CLIProxyAPI/auth /CLIProxyAPI/logs && \
    chmod 777 /CLIProxyAPI/auth /CLIProxyAPI/logs && \
    chmod +x /CLIProxyAPI/entrypoint.sh

# Expose port
EXPOSE 8080

# Set entrypoint
ENTRYPOINT ["/CLIProxyAPI/entrypoint.sh"]