Skip to content

Commit b576eaf

Browse files
committed
Initial commit
1 parent 11fd469 commit b576eaf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1550
-2768
lines changed

.gitignore

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,4 @@
1-
# Rust
2-
/target/
3-
**/*.rs.bk
4-
*.pdb
5-
Cargo.lock
6-
7-
# IDE
8-
.idea/
9-
.vscode/
10-
*.swp
11-
*.swo
12-
*~
13-
.DS_Store
14-
15-
# WireGuard configurations (sensitive)
16-
/wireguard/
17-
*.conf
18-
*.key
19-
20-
# Configuration files (may contain passwords)
21-
/config/
22-
config.toml
23-
24-
# nftables
25-
/nftables/
26-
27-
# Docker
28-
.dockerignore
29-
30-
# Logs
1+
bin/
2+
.tmp/
313
*.log
32-
33-
# Environment files
344
.env
35-
.env.local

Cargo.toml

Lines changed: 0 additions & 42 deletions
This file was deleted.

Dockerfile

Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,19 @@
1-
# Build stage
2-
FROM rust:1.94-alpine AS builder
1+
# syntax=docker/dockerfile:1
32

4-
# Install build dependencies
5-
RUN apk add --no-cache musl-dev
3+
FROM golang:1.25-alpine AS build
4+
WORKDIR /src
5+
COPY go.mod ./
6+
RUN go mod download
7+
COPY . .
8+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /out/wg-manager ./cmd/wg-manager
69

7-
# Create app directory
8-
WORKDIR /app
9-
10-
# Copy manifests
11-
COPY Cargo.toml ./
12-
13-
# Create a dummy main.rs to build dependencies
14-
RUN mkdir src && \
15-
echo "fn main() {}" > src/main.rs && \
16-
cargo build --release && \
17-
rm -rf src
18-
19-
# Copy source code
20-
COPY src ./src
21-
COPY templates ./templates
22-
23-
# Build the application
24-
RUN touch src/main.rs && \
25-
cargo build --release
26-
27-
# Runtime stage
2810
FROM alpine:3.23
29-
30-
# Install runtime dependencies
31-
RUN apk add --no-cache \
32-
wireguard-tools \
33-
nftables \
34-
iptables \
35-
ip6tables \
36-
iproute2 \
37-
bash
38-
39-
# Create necessary directories
40-
RUN mkdir -p /etc/wireguard /etc/wg-manager
41-
42-
# Copy the binary from builder
43-
COPY --from=builder /app/target/release/wg-manager /usr/local/bin/wg-manager
44-
45-
# Copy entrypoint script
46-
COPY entrypoint.sh /entrypoint.sh
11+
RUN apk add --no-cache wireguard-tools nftables iproute2 ca-certificates
12+
COPY --from=build /out/wg-manager /usr/local/bin/wg-manager
13+
COPY docker/entrypoint.sh /entrypoint.sh
4714
RUN chmod +x /entrypoint.sh
48-
49-
# Set environment variables
50-
ENV WG_USERNAME=admin \
51-
WG_PASSWORD=admin \
52-
WG_CONFIG_DIR=/etc/wireguard
53-
54-
# Expose port
55-
EXPOSE 8080
56-
57-
# Set entrypoint
15+
WORKDIR /app
16+
COPY web /app/web
17+
EXPOSE 8080/udp
18+
EXPOSE 8080/tcp
5819
ENTRYPOINT ["/entrypoint.sh"]
59-
CMD ["/usr/local/bin/wg-manager"]

0 commit comments

Comments
 (0)