Skip to content

Commit 958175f

Browse files
committed
devcontainer
1 parent eb0244b commit 958175f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4372
-4215
lines changed

.devcontainer/Dockerfile.dev

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM node:18-bullseye-slim
2+
WORKDIR /app
3+
4+
COPY . .
5+
6+
ENV NODE_ENV development
7+
RUN apt update && apt install -y git curl sudo postgresql-client procps nano
8+
9+
RUN chmod +x .devcontainer/init-cmd.sh
10+
11+
# USER nextjs
12+
13+
EXPOSE 3000
14+
15+
ENV PORT 3000
16+
ENTRYPOINT ["/app/.devcontainer/init-cmd.sh"]

.devcontainer/devcontainer.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
3+
{
4+
"name": "Next ZTNet dev",
5+
6+
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
7+
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
8+
"dockerComposeFile": ["../docker-compose.yml", "docker-compose.yml"],
9+
10+
// The 'service' property is the name of the service for the container that VS Code should
11+
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
12+
"service": "next_ztnet",
13+
// The optional 'workspaceFolder' property is the path VS Code should open by default when
14+
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
15+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
16+
"features": {
17+
"ghcr.io/devcontainers/features/node:1": {}
18+
},
19+
"customizations": {
20+
"vscode": {
21+
"settings": {
22+
"git.path": ["/usr/bin/git", "C:/Program Files/Git/bin/git.exe"]
23+
},
24+
"extensions": [
25+
"esbenp.prettier-vscode",
26+
"eamodio.gitlens",
27+
"GitHub.vscode-pull-request-github",
28+
"ms-azuretools.vscode-docker"
29+
]
30+
}
31+
}
32+
33+
// Features to add to the dev container. More info: https://containers.dev/features.
34+
// "features": {},
35+
36+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
37+
// "forwardPorts": []
38+
39+
// Uncomment the next line if you want start specific services in your Docker Compose config.
40+
// "runServices": [],
41+
42+
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
43+
// "shutdownAction": "none",
44+
45+
// Uncomment the next line to run commands after the container is created.
46+
// "postCreateCommand": "cat /etc/os-release",
47+
48+
// Configure tool-specific properties.
49+
// "customizations": {},
50+
51+
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
52+
// "remoteUser": "devcontainer"
53+
}

.devcontainer/docker-compose.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: "3.1"
2+
services:
3+
# Update this to the name of the service you want to work with in your docker-compose.yml file
4+
next_ztnet:
5+
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
6+
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
7+
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
8+
# array). The sample below assumes your primary file is in the root of your project.
9+
#
10+
build:
11+
context: .
12+
dockerfile: .devcontainer/Dockerfile.dev
13+
14+
volumes:
15+
# Update this to wherever you want VS Code to mount the folder of your project
16+
- ..:/workspaces:cached
17+
18+
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
19+
# cap_add:
20+
# - SYS_PTRACE
21+
# security_opt:
22+
# - seccomp:unconfined
23+
24+
# Overrides default command so things don't shut down after the process ends.
25+
# command: /bin/sh -c "while sleep 1000; do :; done"

.devcontainer/init-cmd.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Create .env file
6+
cat << EOF > .env
7+
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public
8+
ZT_ADDR=${ZT_ADDR}
9+
NEXT_PUBLIC_SITE_NAME=${NEXT_PUBLIC_SITE_NAME}
10+
EOF
11+
12+
until PGPASSWORD=$POSTGRES_PASSWORD psql -h "$POSTGRES_HOST" -U "$POSTGRES_USER" -c '\q'; do
13+
>&2 echo "Postgres is unavailable - sleeping"
14+
sleep 1
15+
done
16+
17+
# apply migrations to the database
18+
echo "Applying migrations to the database..."
19+
npx prisma migrate deploy
20+
echo "Migrations applied successfully!"
21+
22+
while sleep 1000; do :; done

.dockerignore

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.env
2-
Dockerfile
3-
.dockerignore
4-
node_modules
5-
npm-debug.log
6-
README.md
7-
.next
1+
.env
2+
Dockerfile
3+
.dockerignore
4+
node_modules
5+
npm-debug.log
6+
README.md
7+
.next
88
.git
Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
name: General Support Request
2-
description: General support request for Next Ztnet
3-
title: "[Support]: "
4-
labels: ["support", "triage"]
5-
# assignees: []
6-
body:
7-
- type: textarea
8-
id: description
9-
attributes:
10-
label: Describe the problem you are having
11-
validations:
12-
required: true
13-
- type: input
14-
id: version
15-
attributes:
16-
label: Version
17-
description: Use docker image tag or git commit hash
18-
validations:
19-
required: true
20-
- type: textarea
21-
id: logs
22-
attributes:
23-
label: Relevant log output
24-
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
25-
render: shell
26-
validations:
27-
required: false
28-
- type: dropdown
29-
id: os
30-
attributes:
31-
label: Operating system
32-
options:
33-
- Debian
34-
- Ubuntu
35-
- Other Linux
36-
- Windows
37-
- Other
38-
validations:
39-
required: false
40-
- type: textarea
41-
id: other
42-
attributes:
43-
label: Any other information that may be helpful
1+
name: General Support Request
2+
description: General support request for Next Ztnet
3+
title: "[Support]: "
4+
labels: ["support", "triage"]
5+
# assignees: []
6+
body:
7+
- type: textarea
8+
id: description
9+
attributes:
10+
label: Describe the problem you are having
11+
validations:
12+
required: true
13+
- type: input
14+
id: version
15+
attributes:
16+
label: Version
17+
description: Use docker image tag or git commit hash
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: logs
22+
attributes:
23+
label: Relevant log output
24+
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
25+
render: shell
26+
validations:
27+
required: false
28+
- type: dropdown
29+
id: os
30+
attributes:
31+
label: Operating system
32+
options:
33+
- Debian
34+
- Ubuntu
35+
- Other Linux
36+
- Windows
37+
- Other
38+
validations:
39+
required: false
40+
- type: textarea
41+
id: other
42+
attributes:
43+
label: Any other information that may be helpful

.github/dependabot.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
3-
# Please see the documentation for all configuration options:
4-
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5-
6-
version: 2
7-
updates:
8-
- package-ecosystem: "" # See documentation for possible values
9-
directory: "/" # Location of package manifests
10-
schedule:
11-
interval: "weekly"
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

0 commit comments

Comments
 (0)