Last active
November 4, 2022 02:36
-
-
Save rcdelacruz/c84b313876bdf2a2aca96d7b89e8ae66 to your computer and use it in GitHub Desktop.
Brownbag session notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Brownbag Notes | |
This brownbag is a showcase of the toolkits that has been gaining popularity amongst software development community, DevOps community, and open source community. | |
This is not meant to be a workshop for beginners, but to give you an idea on what is going on around the different communities in the IT world. | |
But don’t fret, I’ll be giving you some introductions and basic concepts along the way. And at the end of this sessions, you will gain understanding and awareness of the different tools that may help you leverage or accelerate development by running your projects on your local machine. And hoping that this might help you eliminate or minimize bugs in production environment. | |
<aside> | |
💡 The `docker compose` (with a space) is a newer project to migrate compose to Go with the rest of the docker project. This is the `v2` branch of the [docker/compose](https://github.com/docker/compose/tree/v2) repo. It's been first introduced to Docker Desktop users, so docker users on Linux didn't see the command. In addition to migrating to Go, it uses the compose-spec, and part of the rewrite may result in behavior differences. | |
The original python project, called `docker-compose`, aka v1 of docker/compose repo, has now been deprecated and development has moved over to v2. To install the v2 `docker compose` as a CLI plugin on Linux, supported distribution can now install the `docker-compose-plugin` package. E.g. on debian, I run `apt-get install docker-compose-plugin`. | |
</aside> | |
## devcontainer.json (universal) | |
```bash | |
{ | |
"image": "mcr.microsoft.com/devcontainers/universal:latest", | |
"postAttachCommand": "npm run dev", | |
"features": { | |
"ghcr.io/devcontainers/features/node:1": { | |
"version": "16" | |
} | |
} | |
``` | |
## devcontainer.json (node-specific) | |
```bash | |
{ | |
"image": "mcr.microsoft.com/devcontainers/javascript-node:0-18", | |
"customizations": { | |
"vscode": { | |
"extensions": [ | |
"christian-kohler.npm-intellisense", | |
"dbaeumer.vscode-eslint", | |
"esbenp.prettier-vscode", | |
"eamodio.gitlens", | |
"xabikos.JavaScriptSnippets", | |
"mikestead.dotenv", | |
"aaron-bond.better-comments", | |
"redhat.vscode-yaml", | |
"streetsidesoftware.code-spell-checker", | |
"vscode-icons-team.vscode-icons" | |
] | |
} | |
}, | |
"postAttachCommand": "npm install && npm run dev", | |
"forwardPorts": [3000], | |
"remoteUser": "node" | |
} | |
``` | |
## ansible-pull to install docker and docker-compose (ubuntu and WSL2 only) | |
```jsx | |
ansible-pull -K -U https://github.com/rcdelacruz/ansible-dev-pc.git -C main ~/.ansible/pull/$HOSTNAME/docker/core.yaml -e user=$USER | |
``` | |
Example 0: | |
- Open VS Code | |
- Open a Remote Window | |
- Try a dev container sample... | |
- Pick any programming languages you want | |
Example 1: | |
- create next.app, then add devcontainer.json | |
- open new vs code | |
- create a folder | |
- create a next.js app via cli | |
- add devcontainer configs… | |
- edit and re-configure devcontainer.json | |
Example 2: | |
- create next.js commerce app via git remote | |
- open remote container using github.com/vercel/commerce | |
Example 3: Complex project with docker-compose | |
[https://github.com/bcgov/startup-sample-project-aws-containers](https://github.com/bcgov/startup-sample-project-aws-containers) | |
Example 4: | |
Running Portainer and LocalStack | |
```bash | |
$ mkdir localstack | |
$ cd localstack | |
$ wget https://gitlab.stratpoint.dev/devcontainers/project-wiki/-/raw/main/docker-compose.yml | |
$ docker-compose up -d | |
Open browser and type `http://localhost:9000` #for Portainer | |
Open browser and type `https://localhost.localstack.cloud:4566/health` #to check health status of LocalStack | |
``` | |
Example 5: | |
- Nodejs project with Dockerfile + serverless framework and localstack | |
Example 6: | |
Remote containers via a remote repo | |
Remote server using VS Code and SSH | |
For further reading and additional resources: | |
- Get started today and [download Docker Desktop](https://www.docker.com/get-started). | |
- Learn more about [best practices for writing Dockerfiles](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/). | |
- Read more about [managing data in Dockerfiles](https://docs.docker.com/storage/). | |
- Find official documentation on [Docker Desktop](https://docs.docker.com/desktop/) and [Docker Compose](https://docs.docker.com/compose/). | |
- Preview [project skeleton samples](https://github.com/docker/awesome-compose) on GitHub. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment