Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Commit

Permalink
Update to Compose V2
Browse files Browse the repository at this point in the history
  • Loading branch information
guybarrette committed Jun 8, 2022
1 parent d51dc54 commit 11ba607
Show file tree
Hide file tree
Showing 167 changed files with 16,165 additions and 41,563 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ L09-05 Docker Compose - Sample App/vote/dotnet/Vote/obj/Debug/netcoreapp2.1/Vote
L09-05 Docker Compose - Sample App/worker/dotnet/Worker/obj/Debug/netcoreapp2.1/Worker.assets.cache
L09-05 Docker Compose - Sample App/worker/dotnet/Worker/obj/Debug/netcoreapp2.1/Worker.csproj.AssemblyReference.cache
L09-05 Docker Compose - Sample App/worker/dotnet/Worker/obj/Debug/netcoreapp2.1/Worker.GeneratedMSBuildEditorConfig.editorconfig
L07-02 Multi Stage Build/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs
L07-02 Multi Stage Build/obj/Debug/net6.0/Code.AssemblyInfo.cs
L07-02 Multi Stage Build/obj/Debug/net6.0/Code.AssemblyInfoInputs.cache
L07-02 Multi Stage Build/obj/Debug/net6.0/Code.csproj.AssemblyReference.cache
L07-02 Multi Stage Build/obj/Debug/net6.0/Code.GeneratedMSBuildEditorConfig.editorconfig
L07-02 Multi Stage Build/obj/Debug/net6.0/Code.GlobalUsings.g.cs
L07-02 Multi Stage Build/obj/Debug/net6.0/Code.RazorAssemblyInfo.cache
L07-02 Multi Stage Build/obj/Debug/net6.0/Code.RazorAssemblyInfo.cs
L07-02 Multi Stage Build/obj/Debug/net6.0/project.razor.json
20 changes: 3 additions & 17 deletions L09-04 Docker Compose/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
version: "3.5"
services:
web-fe:
build: .
command: python app.py
ports:
- target: 5000
published: 5000
networks:
- counter-net
volumes:
- type: volume
source: counter-vol
target: /code
- 5000:5000
redis:
image: "redis:alpine"
networks:
counter-net:

networks:
counter-net:

volumes:
counter-vol:
ports:
- 6379
37 changes: 0 additions & 37 deletions L09-05 Docker Compose - Sample App/ExampleVotingApp.sln

This file was deleted.

191 changes: 0 additions & 191 deletions L09-05 Docker Compose - Sample App/LICENSE

This file was deleted.

5 changes: 0 additions & 5 deletions L09-05 Docker Compose - Sample App/MAINTAINERS

This file was deleted.

Binary file removed L09-05 Docker Compose - Sample App/architecture.png
Binary file not shown.
31 changes: 31 additions & 0 deletions L09-05 Docker Compose - Sample App/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# if you're doing anything beyond your local machine, please pin this to a specific version at https://hub.docker.com/_/node/
FROM node:lts

# set our node environment, either development or production
# defaults to production, compose overrides this to development on build and run
ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV

WORKDIR /code

# default to port 80 for node, and 9229 and 9230 (tests) for debug
ARG PORT=80
ENV PORT $PORT
EXPOSE $PORT 9229 9230

COPY package.json /code/package.json
COPY package-lock.json /code/package-lock.json
RUN npm ci

# check every 30s to ensure this service returns HTTP 200
HEALTHCHECK --interval=30s \
CMD node healthcheck.js

# copy in our source code last, as it changes the most
COPY . /code

# if you want to use npm start instead, then use `docker run --init in production`
# so that signals are passed properly. Note the code in index.js is needed to catch Docker signals
# using node here is still more graceful stopping then npm with --init afaik
# I still can't come up with a good production way to run with npm and graceful shutdown
CMD [ "node", "src/index.js" ]
21 changes: 21 additions & 0 deletions L09-05 Docker Compose - Sample App/backend/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2015-2017 Bret Fisher

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions L09-05 Docker Compose - Sample App/backend/healthcheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const http = require("http");

const options = {
timeout: 2000,
host: "localhost",
port: process.env.PORT || 8080,
path: "/healthz" // must be the same as HEALTHCHECK in Dockerfile
};

const request = http.request(options, res => {
console.info("STATUS: " + res.statusCode);
process.exitCode = res.statusCode === 200 ? 0 : 1;
process.exit();
});

request.on("error", function(err) {
console.error("ERROR", err);
process.exit(1);
});

request.end();
Loading

0 comments on commit 11ba607

Please sign in to comment.