Skip to content

Commit

Permalink
feat: create devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
luizchaves committed Oct 10, 2024
1 parent 0bfe328 commit 2e33d73
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ARG VARIANT=20-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

RUN npm install -g pnpm
23 changes: 23 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "LP2",
"build": {
"dockerfile": "Dockerfile"
},

"postCreateCommand": "pnpm install",

"waitFor": "postCreateCommand",

"postAttachCommand": {
"Astro dev": "pnpm run dev"
},

"customizations": {
"codespaces": {
"openFiles": ["./src/pages/index.mdx"]
},
"vscode": {
"extensions": ["astro-build.astro-vscode", "esbenp.prettier-vscode"]
}
}
}
37 changes: 37 additions & 0 deletions .devcontainer/invest-app-auth/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "Invest App Auth",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"VARIANT": "20-bullseye"
}
},

"workspaceFolder": "/workspaces/lp2/public/codes/expressjs/invest-app-auth",

"portsAttributes": {
"3000": {
"label": "Application",
"onAutoForward": "openPreview"
}
},

"forwardPorts": [3000],

"postCreateCommand": "pnpm install && cd /workspaces/lp2/public/codes/expressjs/invest-app-auth && pnpm run dev",

"waitFor": "postCreateCommand",

"postAttachCommand": {
"Server": "pnpm start --host"
},

"customizations": {
"codespaces": {
"openFiles": ["src/index.js"]
},
"vscode": {
"extensions": ["esbenp.prettier-vscode"]
}
}
}
37 changes: 37 additions & 0 deletions .devcontainer/invest-app-mvc/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "Invest App MVC",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"VARIANT": "20-bullseye"
}
},

"workspaceFolder": "/workspaces/lp2/public/codes/expressjs/invest-app-mvc",

"portsAttributes": {
"3000": {
"label": "Application",
"onAutoForward": "openPreview"
}
},

"forwardPorts": [3000],

"postCreateCommand": "pnpm install",

"waitFor": "postCreateCommand",

"postAttachCommand": {
"Server": "pnpm start --host"
},

"customizations": {
"codespaces": {
"openFiles": ["src/index.js"]
},
"vscode": {
"extensions": ["esbenp.prettier-vscode"]
}
}
}
2 changes: 1 addition & 1 deletion src/components/CodeTree.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface Props {
const { src, content, githubUrl } = Astro.props;
const githubLink = githubUrl
? `[Código Fonte](${GITHUB_EDIT_URL + '/public' + src})`
? `[![Open in GitHub](https://github.com/codespaces/badge.svg)](${GITHUB_EDIT_URL + '/public' + src})`
: '';
const codeTree = existsSync(resolve('./public' + src))
Expand Down
2 changes: 0 additions & 2 deletions src/content/classnotes/expressjs/auth/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import CodeTree from '../../../../components/CodeTree.astro';

# {frontmatter.title}

[Código Fonte](https://github.com/ifpb/lp2/tree/main/public/codes/expressjs/invest-app-auth)

<CodeTree src="/codes/expressjs/invest-app-auth" githubUrl={true} />

## Migration
Expand Down
2 changes: 2 additions & 0 deletions src/content/classnotes/expressjs/mvc/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import CodeTree from '../../../../components/CodeTree.astro';

![](/lp2/imgs/expressjs/mvc/mvc-csr.png)

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/ifpb/lp2?devcontainer_path=.devcontainer/invest-app-mvc/devcontainer.json)

<CodeTree src="/codes/expressjs/invest-app-mvc" githubUrl={true} />

## Loader
Expand Down

0 comments on commit 2e33d73

Please sign in to comment.