Skip to content

Instantly share code, notes, and snippets.

View yacinebenkaidali's full-sized avatar
💻

BENKAIDALI Yacine yacinebenkaidali

💻
View GitHub Profile
@yacinebenkaidali
yacinebenkaidali / index.ts
Last active November 19, 2022 10:12
Basic example on how to subscribe to docker container logs and get logs as a stream
import http from "http";
import { Transform } from "stream";
const containerLogsOptions = (id: string) => ({
socketPath: "/var/run/docker.sock",
path: `/containers/${id}/logs?follow=true&stdout=true&stderr=true`,
method: "GET",
headers: {
"Content-Type": "application/json",
},
@yacinebenkaidali
yacinebenkaidali / Dockerfile
Last active August 23, 2022 09:11
Multi stage bulid of a Typescript based nodejs app.
FROM node:alpine as builder
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
# npm run build runs the tsc transpiler