Skip to content

Commit

Permalink
Merge pull request #200 from DefangLabs/jordan/slim-healthchecks
Browse files Browse the repository at this point in the history
Slim healthchecks
  • Loading branch information
jordanstephens authored Sep 19, 2024
2 parents 5a10cea + 8764df9 commit ae8e865
Show file tree
Hide file tree
Showing 39 changed files with 71 additions and 26 deletions.
4 changes: 3 additions & 1 deletion samples/django-postgres/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use an official Python runtime as a parent image
FROM python:3.11-slim

RUN apt-get update && apt-get install -y curl

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
Expand All @@ -19,4 +21,4 @@ COPY . /code/
RUN python manage.py collectstatic --noinput

# Start server
CMD python manage.py migrate && python manage.py createsuperuser && gunicorn crm_platform.wsgi:application --bind 0.0.0.0:8000
CMD python manage.py migrate && python manage.py createsuperuser && gunicorn crm_platform.wsgi:application --bind 0.0.0.0:8000
2 changes: 2 additions & 0 deletions samples/django/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use an official Python runtime as a parent image
FROM python:3.11-slim

RUN apt-get update && apt-get install -y curl

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
Expand Down
4 changes: 2 additions & 2 deletions samples/golang-http-form/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .

# Start a new stage from scratch
FROM alpine:latest
FROM golang:1.20-slim

RUN apk --no-cache add ca-certificates
RUN apt update && apt install -y curl ca-certificates

WORKDIR /root/

Expand Down
2 changes: 1 addition & 1 deletion samples/golang-http-form/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ services:
reservations:
memory: 50M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/"]
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
5 changes: 3 additions & 2 deletions samples/golang-mongodb-atlas/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o taskmanager .

# Start a new stage from scratch
FROM alpine:latest
FROM golang:1.20-slim

RUN apt update && apt install -y curl ca-certificates

WORKDIR /root/

Expand All @@ -30,4 +32,3 @@ EXPOSE 8080

# Command to run the executable
CMD ["./taskmanager"]

2 changes: 2 additions & 0 deletions samples/golang-mongodb-atlas/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ services:
# resources:
# reservations:
# memory: 256M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
4 changes: 2 additions & 2 deletions samples/golang-openai/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .

# Start a new stage from scratch
FROM alpine:latest
FROM golang:1.20-slim

RUN apk --no-cache add ca-certificates
RUN apt update && apt install -y curl ca-certificates

WORKDIR /root/

Expand Down
2 changes: 1 addition & 1 deletion samples/golang-openai/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ services:
reservations:
memory: 50M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/"]
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
4 changes: 2 additions & 2 deletions samples/golang-rest-api/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .

# Start a new stage from scratch
FROM alpine:latest
FROM golang:1.20-slim

RUN apk --no-cache add ca-certificates
RUN apt update && apt install -y curl ca-certificates

WORKDIR /root/

Expand Down
2 changes: 1 addition & 1 deletion samples/golang-rest-api/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ services:
reservations:
memory: 50M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/"]
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
4 changes: 2 additions & 2 deletions samples/golang-s3/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .

# Start a new stage from scratch
FROM alpine:latest
FROM golang:1.20-slim

RUN apk --no-cache add ca-certificates
RUN apt update && apt install -y curl ca-certificates

WORKDIR /root/

Expand Down
2 changes: 1 addition & 1 deletion samples/golang-s3/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ services:
reservations:
memory: 50M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/"]
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
6 changes: 3 additions & 3 deletions samples/golang-slackbot/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .

# Start a new stage from scratch
FROM alpine:latest
FROM golang:1.20-slim

RUN apk --no-cache add ca-certificates
RUN apt update && apt install -y curl ca-certificates

WORKDIR /root/

Expand All @@ -30,4 +30,4 @@ COPY --from=builder /src/main .
EXPOSE 8080

# Run the binary
CMD ["./main"]
CMD ["./main"]
2 changes: 2 additions & 0 deletions samples/golang-slackbot/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ services:
# resources:
# reservations:
# memory: 256M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
4 changes: 3 additions & 1 deletion samples/javalin/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ RUN mvn clean package
# Stage 2: Create the runtime image
FROM openjdk:17-jdk-slim

RUN apt-get update && apt-get install -y curl

# Set the working directory
WORKDIR /app

Expand All @@ -25,4 +27,4 @@ COPY --from=build /app/target/defang-javalin-1.0.0.jar /app/app.jar
EXPOSE 7000

# Command to run the Javalin application
CMD ["java", "-jar", "/app/app.jar"]
CMD ["java", "-jar", "/app/app.jar"]
2 changes: 2 additions & 0 deletions samples/javalin/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ services:
- target: 7000
published: 7000
mode: ingress
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7000/"]
2 changes: 2 additions & 0 deletions samples/langchain/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use an official Python runtime as a parent image
FROM python:3.11-slim

RUN apt-get update && apt-get install -y curl

# Set the working directory in the container
WORKDIR /app

Expand Down
2 changes: 2 additions & 0 deletions samples/langchain/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ services:
published: 8080
protocol: tcp
mode: ingress
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
2 changes: 2 additions & 0 deletions samples/nodejs-chatroom/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use the slim version of Node.js on Debian Bookworm as the base image
FROM node:20-bookworm-slim

RUN apt-get update && apt-get install -y curl

# Set the working directory to /app
WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion samples/nodejs-chatroom/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ services:
reservations:
memory: 256M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/"]
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
2 changes: 2 additions & 0 deletions samples/nodejs-express/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use the slim version of Node.js on Debian Bookworm as the base image
FROM node:20-bookworm-slim

RUN apt-get update && apt-get install -y curl

# Set the working directory to /app
WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion samples/nodejs-express/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ services:
reservations:
memory: 256M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/"]
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
2 changes: 2 additions & 0 deletions samples/nodejs-form/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use the slim version of Node.js on Debian Bookworm as the base image
FROM node:20-bookworm-slim

RUN apt-get update && apt-get install -y curl

# Set the working directory to /app
WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion samples/nodejs-form/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ services:
reservations:
memory: 256M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/"]
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
2 changes: 2 additions & 0 deletions samples/nodejs-http/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use the slim version of Node.js on Debian Bookworm as the base image
FROM node:20-bookworm-slim

RUN apt-get update && apt-get install -y curl

# Set the working directory to /app
WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion samples/nodejs-http/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ services:
reservations:
memory: 256M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/"]
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
2 changes: 2 additions & 0 deletions samples/nodejs-openai/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use the slim version of Node.js on Debian Bookworm as the base image
FROM node:20-bookworm-slim

RUN apt-get update && apt-get install -y curl

# Set the working directory to /app
WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion samples/nodejs-openai/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ services:
reservations:
memory: 256M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/"]
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
2 changes: 2 additions & 0 deletions samples/nodejs-rest-api/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use the slim version of Node.js on Debian Bookworm as the base image
FROM node:20-bookworm-slim

RUN apt-get update && apt-get install -y curl

# Set the working directory to /app
WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion samples/nodejs-rest-api/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ services:
reservations:
memory: 256M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/"]
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
2 changes: 2 additions & 0 deletions samples/nodejs-s3/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use the slim version of Node.js on Debian Bookworm as the base image
FROM node:20-bookworm-slim

RUN apt-get update && apt-get install -y curl

# Set the working directory to /app
WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion samples/nodejs-s3/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ services:
reservations:
memory: 256M
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/"]
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
2 changes: 2 additions & 0 deletions samples/rails/app/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@
/app/assets/builds/*
!/app/assets/builds/.keep
/public/assets

/test
2 changes: 2 additions & 0 deletions samples/sailsjs-postgres/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use the slim version of Node.js on Debian Bookworm as the base image
FROM node:20-bookworm-slim

RUN apt-get update && apt-get install -y curl

# Create app directory
WORKDIR /usr/src/app

Expand Down
2 changes: 2 additions & 0 deletions samples/sailsjs-postgres/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ services:
# resources:
# reservations:
# memory: 256M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:1337/"]

networks:
app-network:
Expand Down
2 changes: 2 additions & 0 deletions samples/svelte-mysql/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RUN npm install --legacy-peer-deps && npm run build
# Stage 2: Build Node.js backend
FROM node:20-bookworm-slim as backend

RUN apt-get update && apt-get install -y curl

WORKDIR /app

# Copy backend source code
Expand Down
2 changes: 2 additions & 0 deletions samples/svelte-mysql/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ services:
- "3001:3001"
depends_on:
- db
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/"]
#deploy:
# resources:
# reservations:
Expand Down
2 changes: 2 additions & 0 deletions samples/sveltekit-mongodb/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Use the slim version of Node.js v20 on Debian Bookworm as the base image
FROM node:20-bookworm-slim

RUN apt-get update && apt-get install -y curl

# Set the working directory
WORKDIR /app

Expand Down
2 changes: 2 additions & 0 deletions samples/sveltekit-mongodb/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ services:
# resources:
# reservations:
# memory: 256M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/"]

mongo:
restart: unless-stopped
Expand Down

0 comments on commit ae8e865

Please sign in to comment.