Skip to content

Commit

Permalink
feat: support devcontainer for dev
Browse files Browse the repository at this point in the history
  • Loading branch information
bzp2010 committed Nov 21, 2024
1 parent 4bbb7cc commit 00c04b0
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ubuntu:24.04

RUN apt update && export DEBIAN_FRONTEND=noninteractive \
&& apt install -y sudo git make gcc

COPY Makefile .requirements apisix-master-0.rockspec ./
COPY utils/install-dependencies.sh utils/linux-install-luarocks.sh utils/

RUN make deps
13 changes: 13 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "APISIX",
"dockerComposeFile": ["docker-compose.yml"],
"service": "apisix",
"workspaceFolder": "/workspace",
"postCreateCommand": "bash -c 'cd /workspace && make deps'",
"customizations": {
"vscode": {
"extensions": ["ms-vscode.makefile-tools", "ms-azuretools.vscode-docker", "sumneko.lua"]
}
},
"forwardPorts": [9080, 9180, 2379]
}
22 changes: 22 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
services:
apisix:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
command: sleep infinity
restart: always
volumes:
- ..:/workspace:cached
network_mode: service:etcd
etcd:
image: bitnami/etcd:3.5
restart: always
volumes:
- etcd_data:/bitnami/etcd
environment:
ALLOW_NONE_AUTHENTICATION: "yes"
ETCD_ADVERTISE_CLIENT_URLS: "http://127.0.0.1:2379"
ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"

volumes:
etcd_data:
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ init: runtime
.PHONY: run
run: runtime
@$(call func_echo_status, "$@ -> [ Start ]")
rm -f logs/worker_events.sock logs/stream_worker_events.sock ## Cleanup stale event broker unix socket file
$(ENV_APISIX) start
@$(call func_echo_success_status, "$@ -> [ Done ]")

Expand Down

0 comments on commit 00c04b0

Please sign in to comment.