Compare commits
5 Commits
3f0d1d77ca
...
mike/scs-d
Author | SHA1 | Date | |
---|---|---|---|
ebf03f3e56 | |||
7aa80d9800 | |||
761ea8fef8 | |||
94a71d6d77 | |||
66fc64dcac |
@ -1,5 +1,8 @@
|
||||
FROM node:lts-alpine3.22 AS base
|
||||
HEALTHCHECK --interval=5s --timeout=10s --start-period=5s --retries=5 \
|
||||
HEALTHCHECK --interval=5s \
|
||||
--timeout=10s \
|
||||
--start-period=5s \
|
||||
--retries=5 \
|
||||
CMD sh -c 'wget --no-verbose --tries=1 --spider http://127.0.0.1:3333 || exit 1'
|
||||
|
||||
# All deps stage
|
||||
@ -9,11 +12,10 @@ ADD package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
FROM deps AS develop
|
||||
WORKDIR /app
|
||||
COPY dev-entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
RUN cat /entrypoint.sh
|
||||
ENV NODE_ENV=development
|
||||
WORKDIR /app
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
EXPOSE 3333
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
echo "starting up..."
|
||||
node ace generate:key
|
||||
|
||||
|
||||
# Check for pending migrations by parsing output
|
||||
PENDING_MIGRATIONS=$(node ace migration:status | grep -ic 'pending')
|
||||
|
@ -12,6 +12,6 @@ import UsersController from '#controllers/users_controller'
|
||||
router.get('users', [UsersController, 'index'])
|
||||
router.get('/', async () => {
|
||||
return {
|
||||
hello: 'world',
|
||||
hello: 'SCS',
|
||||
}
|
||||
})
|
||||
|
@ -1,3 +1,4 @@
|
||||
name: fullstack
|
||||
services:
|
||||
frontend:
|
||||
image: frontend:latest
|
||||
@ -22,14 +23,10 @@ services:
|
||||
image: backend:latest
|
||||
build:
|
||||
context: ./backend
|
||||
volumes:
|
||||
- backend_node_modules:/backend/node_modules
|
||||
- ./backend/:/backend
|
||||
labels:
|
||||
- "traefik.http.middlewares.strip-api-prefix.stripprefix.prefixes=/api"
|
||||
- "traefik.http.routers.backend.rule=Host(`app.docker.localhost`) && PathPrefix(`/api`)"
|
||||
- "traefik.http.routers.backend.middlewares=strip-api-prefix@docker"
|
||||
|
||||
env_file:
|
||||
- ./backend/.env
|
||||
depends_on:
|
||||
|
@ -5,12 +5,9 @@ RUN yarn install
|
||||
COPY . .
|
||||
|
||||
FROM base AS build
|
||||
WORKDIR /app
|
||||
COPY --from=base /app/* .
|
||||
RUN yarn build
|
||||
|
||||
FROM base AS develop
|
||||
COPY --from=base /app/ .
|
||||
EXPOSE 5173
|
||||
ENTRYPOINT [ "yarn", "dev", "--host", "0.0.0.0" ]
|
||||
|
||||
|
BIN
slides/images/pexels-joshsorenson-1714208.jpg
Normal file
BIN
slides/images/pexels-joshsorenson-1714208.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 MiB |
BIN
slides/images/pexels-luis-gomes-166706-546819.jpg
Normal file
BIN
slides/images/pexels-luis-gomes-166706-546819.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 132 KiB |
BIN
slides/images/pexels-markusspiske-1089438.jpg
Normal file
BIN
slides/images/pexels-markusspiske-1089438.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 MiB |
178
slides/slides.md
178
slides/slides.md
@ -5,15 +5,13 @@ theme: seriph
|
||||
# like them? see https://unsplash.com/collections/94734566/slidev
|
||||
background: https://cover.sli.dev
|
||||
# some information about your slides (markdown enabled)
|
||||
title: Welcome to Slidev
|
||||
title: Demystifying Docker - SCS 2025
|
||||
info: |
|
||||
## Slidev Starter Template
|
||||
Presentation slides for developers.
|
||||
## The basics of containerization and beyond by Mike Conrad
|
||||
Scenic City Summit 2025
|
||||
|
||||
Learn more at [Sli.dev](https://sli.dev)
|
||||
# apply unocss classes to the current slide
|
||||
Learn more at [Hackanooga](https://hackanooga.com/scs)
|
||||
class: text-center
|
||||
# https://sli.dev/features/drawing
|
||||
drawings:
|
||||
persist: false
|
||||
# slide transition: https://sli.dev/guide/animations.html#slide-transitions
|
||||
@ -52,36 +50,21 @@ The last comment block of each slide will be treated as slide notes. It will be
|
||||
|
||||
---
|
||||
transition: fade-out
|
||||
layout: center
|
||||
layout: statement
|
||||
background: ./images/pexels-markusspiske-1089438.jpg
|
||||
---
|
||||
|
||||
# Who is this for?
|
||||
|
||||
## About you
|
||||
- Some experience with Docker/containers
|
||||
- Familiarity with Linux/BASH
|
||||
- Want to better understand how containers work
|
||||
- Want to learn new techniques for automation
|
||||
|
||||
---
|
||||
transition: fade-out
|
||||
layout: center
|
||||
---
|
||||
|
||||
## Follow Along
|
||||
**Example Repo** - https://hackanooga.com/scs
|
||||
|
||||
**Prerequisites**
|
||||
- Docker
|
||||
- VSCode
|
||||
- Git
|
||||
- yarn/npm/pnpm,etc (For viewing slides)
|
||||
|
||||
### VSCode plugins
|
||||
- [Official Docker Plugin](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)
|
||||
- [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
|
||||
- [Container Tools](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-containers)
|
||||
|
||||
# The 3 universal constants in programming
|
||||
<v-click>
|
||||
<h2>1) The speed of light</h2>
|
||||
</v-click>
|
||||
<v-click>
|
||||
<h2>2) "It's more complicated than you think"</h2>
|
||||
</v-click>
|
||||
<v-click>
|
||||
<h2>3) "It works on my machine"</h2>
|
||||
<br />
|
||||
<small>Source: <a href="https://www.linkedin.com/posts/robertroskam_the-3-universal-constants-in-programming-activity-7339260450074775553-ofik?utm_source=share&utm_medium=member_desktop&rcm=ACoAACZXneYB_uWiOE0T9VO3caUkn7m0ZMrRS_o">Some random guy on the internet</a></small>
|
||||
</v-click>
|
||||
|
||||
---
|
||||
transition: fade-out
|
||||
@ -90,18 +73,42 @@ layout: center
|
||||
|
||||
<img src="./images/docker-meme.jpg" width="300"/>
|
||||
|
||||
|
||||
---
|
||||
transition: fade-out
|
||||
layout: center
|
||||
layout: image-right
|
||||
image: ./images/pexels-markusspiske-1089438.jpg
|
||||
---
|
||||
|
||||
## Common Use cases for containers
|
||||
- Reproducible dev environments
|
||||
- Testing in CI/CD environments
|
||||
- Better "Portability" of application code
|
||||
- Snapshot of application code at specific point in time
|
||||
# Who is this for?
|
||||
|
||||
## About you
|
||||
- Some experience with Docker/containers
|
||||
- Familiarity with Linux/BASH/zsh, etc
|
||||
- Want to better understand how containers work
|
||||
- Want to learn new techniques for automation
|
||||
|
||||
---
|
||||
transition: fade-out
|
||||
layout: image-left
|
||||
image: ./images/pexels-joshsorenson-1714208.jpg
|
||||
---
|
||||
|
||||
## Follow Along
|
||||
<small>Visit the link to check out the sample Git repository.</small>
|
||||
|
||||
**Example Repo** - https://hackanooga.com/scs
|
||||
|
||||
**Prerequisites**
|
||||
- Docker Engine (Linux) or Docker Desktop (Windows/MacOS)
|
||||
- VSCode
|
||||
- Git
|
||||
- yarn, npm or pnpm (for viewing slides)
|
||||
|
||||
### VSCode plugins
|
||||
- [Official Docker Plugin](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)
|
||||
- [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
|
||||
- [Container Tools](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-containers)
|
||||
|
||||
---
|
||||
transition: fade-out
|
||||
@ -126,13 +133,13 @@ layout: center
|
||||
|
||||
## Containers vs Virtual Machines
|
||||
|
||||
| Feature | VM | Container |
|
||||
|------------------|----------------|------------------|
|
||||
| Boot time | Minutes | Seconds |
|
||||
| Resource usage | Heavy | Lightweight |
|
||||
| Isolation | Strong | Process-level |
|
||||
| Portability | Medium | Very High |
|
||||
|
||||
| Feature | VMs | Containers |
|
||||
|------------------|-----------------------|------------------------------|
|
||||
| Boot time | Minutes | Seconds |
|
||||
| Resource usage | Heavy | Lightweight |
|
||||
| Isolation | Strong | Process-level |
|
||||
| Portability | Medium | Very High |
|
||||
| Operating System | Needs full OS install | Uses host OS/kernel features |
|
||||
In reality we use containers and vm's together. Containers run inside of VM's for better security and isolation, especially in cloud and multi tenant environments.
|
||||
|
||||
---
|
||||
@ -142,26 +149,17 @@ layout: center
|
||||
|
||||
## What is Docker?
|
||||
|
||||
- A tool to build and run containers
|
||||
- Written in GO
|
||||
- Uses Client/Server model with REST API (`docker cli` and `dockerd`)
|
||||
- Eco system of tools (Compose, Swarm, etc)
|
||||
- Public Image Registry (Dockerhub)
|
||||
- Docker client typically runs on same machine as server but doesn't have to
|
||||
|
||||
---
|
||||
transition: fade-out
|
||||
layout: center
|
||||
---
|
||||
## What is Docker?
|
||||
|
||||
- A tool to build and run containers
|
||||
- Containers are exclusive to Linux
|
||||
- Docker engine runs containers using Linux features like:
|
||||
- Namespaces
|
||||
- cgroups
|
||||
- Union file systems
|
||||
- Container runs from an image layered with base image and application code
|
||||
|
||||
- Uses Linux kernal features like:
|
||||
- Namespaces
|
||||
- cgroups
|
||||
- Union file systems
|
||||
- Containers are just processes
|
||||
---
|
||||
transition: fade-out
|
||||
layout: center
|
||||
@ -193,24 +191,42 @@ layout: center
|
||||
|
||||
---
|
||||
transition: fade-out
|
||||
layout: center
|
||||
layout: two-cols-header
|
||||
---
|
||||
|
||||
## Bind/Volume Mounts
|
||||
<div class="flex items-center flex-col">
|
||||
<h1 class="ml-5">Bind/Volume Mounts</h1>
|
||||
|
||||
- 2 most common storage mechanisms
|
||||
- Different use cases and security implications
|
||||
<p>2 most common storage mechanisms<br />Different use cases and security implications</p>
|
||||
</div>
|
||||
::left::
|
||||
## Bind Mounts
|
||||
|
||||
- Created/managed by user.
|
||||
- Files from host mounted directly into container.
|
||||
- Container processes can modify files on host system.
|
||||
- Strongly tied to the host.
|
||||
- Best for things like dev containers.
|
||||
|
||||
::right::
|
||||
|
||||
|
||||
## Volume mounts
|
||||
- Created/managed by Docker Daemon.
|
||||
- Data is stored on host filesystem.
|
||||
- Used for persistent data.
|
||||
|
||||
<!--
|
||||
It is possible to modify the data directly via normal tools but unsupported and can cause unintended side-effects due to the overlayfs storage driver.
|
||||
An example would be creating a postgres volume for persistent database storage.
|
||||
-->
|
||||
---
|
||||
transition: fade-out
|
||||
layout: center
|
||||
image: 'https://unsplash.com/collections/oGE7TYSLt3I/software-development
|
||||
equal: false
|
||||
left: false
|
||||
---
|
||||
## Bind Mounts
|
||||
|
||||
- Mounting files/directories from the host machine directly into a container (merged overlayfs layer).
|
||||
- Processes inside container can modify files on host system.
|
||||
- Bind mounts are strongly tied to the host
|
||||
- Best for things like dev containers where you need to mount source code into container and have hot reload, etc.
|
||||
|
||||
## Bind Mount Example
|
||||
```bash
|
||||
@ -264,20 +280,6 @@ $ docker volume inspect postgresData
|
||||
- Docker creates a volume named postgresData and mounts that directory inside the container.
|
||||
<!-- https://docs.docker.com/engine/storage/bind-mounts/ -->
|
||||
|
||||
---
|
||||
transition: fade-out
|
||||
layout: center
|
||||
---
|
||||
|
||||
## Volume mounts
|
||||
- Created and managed by the Docker Daemon
|
||||
- Volume data is stored on host filesystem but managed by Docker.
|
||||
- Used for persistent data.
|
||||
|
||||
<!--
|
||||
It is possible to modify the data directly via normal tools but unsupported and can cause unintended side-effects due to the overlayfs storage driver.
|
||||
An example would be creating a postgres volume for persistent database storage.
|
||||
-->
|
||||
|
||||
---
|
||||
transition: fade-out
|
||||
@ -330,7 +332,7 @@ EXPOSE 5173
|
||||
|
||||
```bash
|
||||
$ docker build -t react .
|
||||
$ docker run --rm -P react
|
||||
$ docker run --rm -p 5173:5173 react
|
||||
```
|
||||
<!--
|
||||
Run docker image and demonstrate dev container functionality. Attach to the running container
|
||||
|
Reference in New Issue
Block a user