Spaces:
Sleeping
Sleeping
update: change image golang:1.20 to golang:1.20-alpine3.19
Browse files- .dockerignore +2 -0
- .env +1 -1
- Dockerfile +24 -4
.dockerignore
CHANGED
|
@@ -11,6 +11,7 @@ README.md
|
|
| 11 |
/haproxy
|
| 12 |
|
| 13 |
# Compose
|
|
|
|
| 14 |
docker-compose.yaml
|
| 15 |
|
| 16 |
# Make
|
|
@@ -23,6 +24,7 @@ Makefile
|
|
| 23 |
runner.conf
|
| 24 |
|
| 25 |
# Testing
|
|
|
|
| 26 |
/tests
|
| 27 |
/postman
|
| 28 |
coverage.out
|
|
|
|
| 11 |
/haproxy
|
| 12 |
|
| 13 |
# Compose
|
| 14 |
+
Dockerfile
|
| 15 |
docker-compose.yaml
|
| 16 |
|
| 17 |
# Make
|
|
|
|
| 24 |
runner.conf
|
| 25 |
|
| 26 |
# Testing
|
| 27 |
+
.env
|
| 28 |
/tests
|
| 29 |
/postman
|
| 30 |
coverage.out
|
.env
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
# TebakAja Proxy
|
| 2 |
TEBAKAJA_PROXY_HOST=0.0.0.0
|
| 3 |
-
TEBAKAJA_PROXY_PORT=
|
| 4 |
|
| 5 |
# TebakAja CORS
|
| 6 |
TEBAKAJA_CORS_ALLOW_ORIGINS=https://huggingface.co,https://qywok-tebakaja-proxy-space-0.hf.space,https://qywok-tebakaja-proxy-space-1.hf.space,https://qywok-tebakaja-proxy-space-2.hf.space
|
|
|
|
| 1 |
# TebakAja Proxy
|
| 2 |
TEBAKAJA_PROXY_HOST=0.0.0.0
|
| 3 |
+
TEBAKAJA_PROXY_PORT=80
|
| 4 |
|
| 5 |
# TebakAja CORS
|
| 6 |
TEBAKAJA_CORS_ALLOW_ORIGINS=https://huggingface.co,https://qywok-tebakaja-proxy-space-0.hf.space,https://qywok-tebakaja-proxy-space-1.hf.space,https://qywok-tebakaja-proxy-space-2.hf.space
|
Dockerfile
CHANGED
|
@@ -1,16 +1,36 @@
|
|
| 1 |
-
FROM golang:1.20
|
| 2 |
|
| 3 |
LABEL creator="qywok"
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
COPY go.mod go.sum ./
|
|
|
|
| 8 |
RUN go mod download
|
| 9 |
|
| 10 |
COPY . .
|
| 11 |
|
| 12 |
-
RUN go build -o main
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
EXPOSE
|
| 15 |
|
| 16 |
CMD ["./main"]
|
|
|
|
| 1 |
+
FROM golang:1.20-alpine3.19
|
| 2 |
|
| 3 |
LABEL creator="qywok"
|
| 4 |
|
| 5 |
+
ENV APP_DIR=/tebakaja_proxy \
|
| 6 |
+
GO111MODULE=on \
|
| 7 |
+
CGO_ENABLED=0 \
|
| 8 |
+
DOTENV=.env \
|
| 9 |
+
HOST=0.0.0.0 \
|
| 10 |
+
PORT=7860
|
| 11 |
+
|
| 12 |
+
WORKDIR ${APP_DIR}
|
| 13 |
|
| 14 |
COPY go.mod go.sum ./
|
| 15 |
+
|
| 16 |
RUN go mod download
|
| 17 |
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
+
RUN go build -o main . && \
|
| 21 |
+
go clean -modcache && \
|
| 22 |
+
rm -rf /var/cache/apk/* \
|
| 23 |
+
/root/.cache/go-build /root/go/pkg
|
| 24 |
+
|
| 25 |
+
RUN cat > ${DOTENV} <<EOF
|
| 26 |
+
TEBAKAJA_PROXY_HOST=${HOST}
|
| 27 |
+
TEBAKAJA_PROXY_PORT=${PORT}
|
| 28 |
+
|
| 29 |
+
TEBAKAJA_CORS_ALLOW_ORIGINS=https://huggingface.co,https://qywok-tebakaja-proxy-space-0.hf.space,https://qywok-tebakaja-proxy-space-1.hf.space,https://qywok-tebakaja-proxy-space-2.hf.space
|
| 30 |
+
TEBAKAJA_CORS_ALLOW_HEADERS=*
|
| 31 |
+
TEBAKAJA_CORS_ALLOW_METHODS=GET,POST
|
| 32 |
+
EOF
|
| 33 |
|
| 34 |
+
EXPOSE ${PORT}
|
| 35 |
|
| 36 |
CMD ["./main"]
|