Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM golang:alpine AS builder

LABEL maintainer="d0mhate"

RUN apk add --update upx

WORKDIR /build

# сначала копируем go.mod и go.sum для кэширования зависимостей
COPY go.* ./
# COPY vendor ./vendor
RUN go mod download

COPY . .

ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64

RUN go build -mod=vendor -ldflags="-s -w" -o /app/tg-ws-proxy cmd/tg-ws-proxy/main.go

RUN upx --lzma /app/tg-ws-proxy

#########################

# scratch
FROM alpine:latest

COPY --from=builder /app/tg-ws-proxy /bin/tg-ws-proxy

ENTRYPOINT ["/bin/tg-ws-proxy"]

CMD ["--host", "0.0.0.0"]
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: tg-ws-proxy-go

services:
backend:
container_name: tg-ws-proxy-go
build:
context: .
dockerfile: Dockerfile
ports:
- "1080:1080"
command: ["--host", "0.0.0.0"]