Skip to content

Commit c33efe8

Browse files
authored
feat(dev-container): add dev container (#8554)
Many macOS developers use Homebrew to manage packages, and Homebrew often installs its own version of libgit2 as a shared dependency for other tools. This system-level installation frequently conflicts with the version required by the plugin, forcing developers into complex workarounds. Dev container allow developers to overcome the issues regarding git2go allowing them to properly test and run the code while contributing to the project.
1 parent 04a2532 commit c33efe8

File tree

4 files changed

+155
-0
lines changed

4 files changed

+155
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
FROM mcr.microsoft.com/devcontainers/go:1-1.22-bookworm
17+
18+
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib:/usr/local/lib/pkgconfig
19+
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
20+
ENV DEVLAKE_PLUGINS=bamboo,bitbucket,circleci,customize,dora,gitextractor,github,github_graphql,gitlab,jenkins,jira,org,pagerduty,refdiff,slack,sonarqube,trello,webhook
21+
22+
RUN apt-get update -y
23+
RUN apt-get install pkg-config python3-dev default-libmysqlclient-dev build-essential libpq-dev cmake -y
24+
RUN git clone -b v1.3.0 https://github.com/libgit2/libgit2.git && cd libgit2 && mkdir build && cd build && cmake .. && make && make install

.devcontainer/devcontainer.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
{
20+
"name": "Go",
21+
"dockerComposeFile": "docker-compose.yml",
22+
"service": "devcontainer",
23+
"workspaceFolder": "/workspace",
24+
"features": {
25+
"ghcr.io/jungaretti/features/make:1": {},
26+
"ghcr.io/devcontainers/features/docker-in-docker:2.12.0": {},
27+
"ghcr.io/devcontainers/features/python:1": {
28+
"version": "3.9"
29+
},
30+
"ghcr.io/devcontainers-extra/features/poetry:2": {},
31+
"ghcr.io/devcontainers/features/node:1": {
32+
"version": "18"
33+
}
34+
},
35+
"forwardPorts": [
36+
4000,
37+
8080
38+
],
39+
"postCreateCommand": "npm install commitizen -g",
40+
"customizations": {
41+
"vscode": {
42+
"extensions": [
43+
"streetsidesoftware.code-spell-checker"
44+
]
45+
}
46+
},
47+
"remoteUser": "root"
48+
}

.devcontainer/docker-compose.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
version: '3.8'
17+
services:
18+
devcontainer:
19+
build:
20+
dockerfile: Dockerfile
21+
volumes:
22+
- ..:/workspace
23+
networks:
24+
- default
25+
command: sleep infinity
26+
mysql:
27+
image: mysql:8
28+
volumes:
29+
- mysql-storage:/var/lib/mysql
30+
restart: always
31+
ports:
32+
- 3306:3306
33+
environment:
34+
MYSQL_ROOT_PASSWORD: admin
35+
MYSQL_DATABASE: lake
36+
MYSQL_USER: merico
37+
MYSQL_PASSWORD: merico
38+
TZ: UTC
39+
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --skip-log-bin
40+
networks:
41+
- default
42+
grafana:
43+
image: devlake.docker.scarf.sh/apache/devlake-dashboard:latest
44+
ports:
45+
- 3002:3000
46+
volumes:
47+
- grafana-storage:/var/lib/grafana
48+
environment:
49+
GF_SERVER_ROOT_URL: "http://localhost:4000/grafana"
50+
GF_USERS_DEFAULT_THEME: "light"
51+
MYSQL_URL: mysql:3306
52+
MYSQL_DATABASE: lake
53+
MYSQL_USER: merico
54+
MYSQL_PASSWORD: merico
55+
TZ: UTC
56+
restart: always
57+
depends_on:
58+
- mysql
59+
networks:
60+
- default
61+
62+
volumes:
63+
mysql-storage:
64+
grafana-storage:

.devcontainer/post-install.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
make dep
19+
npm install commitizen -g

0 commit comments

Comments
 (0)