feat: add Docker configuration for PostgreSQL and Gitea services with clangd support

This commit is contained in:
ngc2207 2025-01-10 15:47:15 +08:00
parent 3cf2cd156a
commit f7f1e01b72
4 changed files with 97 additions and 0 deletions

1
docker/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env

66
docker/compose.yml Normal file
View File

@ -0,0 +1,66 @@
volumes:
postgres:
driver: local
gitea:
driver: local
services:
postgres:
image: docker.io/library/postgres:14
container_name: postgres
restart: always
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- postgres:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ]
interval: 5s
timeout: 5s
retries: 5
start_period: 5s
gitea:
image: docker.io/gitea/gitea:1.22.6
container_name: gitea
restart: always
environment:
- GITEA__database__DB_TYPE=postgres
- GITEA__database__HOST=postgres:5432
- GITEA__database__NAME=${POSTGRES_DB}
- GITEA__database__USER=${POSTGRES_USER}
- GITEA__database__PASSWD=${POSTGRES_PASSWORD}
volumes:
- gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "22:22"
depends_on:
postgres:
condition: service_healthy
lsp-c:
image: clangd:latest
build:
context: ./lsp/clangd
dockerfile: Dockerfile
container_name: lsp-c
restart: always
ports:
- "30001:3000"
lsp-cpp:
image: clangd:latest
build:
context: ./lsp/clangd
dockerfile: Dockerfile
container_name: lsp-cpp
restart: always
ports:
- "30002:3000"

View File

@ -0,0 +1,25 @@
FROM alpine:latest as builder
RUN apk add --no-cache git npm
WORKDIR /app
RUN git clone https://github.com/wylieconlon/jsonrpc-ws-proxy.git
WORKDIR /app/jsonrpc-ws-proxy
COPY servers.yml .
RUN npm install && npm run prepare
FROM alpine:latest
RUN apk add --no-cache build-base clang-extra-tools nodejs
WORKDIR /app/jsonrpc-ws-proxy
COPY --from=builder /app/jsonrpc-ws-proxy .
EXPOSE 3000
CMD ["node", "dist/server.js", "--port", "3000", "--languageServers", "servers.yml"]

View File

@ -0,0 +1,5 @@
langservers:
clangd:
- /usr/bin/clangd
- --log=verbose
- --background-index