Skip to content

Instantly share code, notes, and snippets.

View wodCZ's full-sized avatar

Martin Janeček wodCZ

View GitHub Profile
@wodCZ
wodCZ / main.py
Last active July 29, 2021 12:32
Simple starter for a String Calculator kata (first 3 steps done)
# This is a simple starter for a String Calculator kata (https://osherove.com/tdd-kata-1/)
# The following link could be useful for working with the input string:
# https://developers.google.com/edu/python/strings
def add(numbers):
# Here, write the actual implementation.
# Don't forget to commit your changes, at least every time you solve a step.
# Also, don't be afraid to modify any of the existing code. Refactoring is your friend - as the complexity of
# the program grows, the readability of the code is crucial for future maintainability.
@wodCZ
wodCZ / Dockerfile
Created October 15, 2021 11:34
Sample node.js Dockerfile
##################################
# Dev dependencies stage, only prepares node_modules, that are later reused
##################################
FROM node:14-slim as devdependencies
USER node
WORKDIR /app
COPY --chown=node:node package.json yarn.lock ./
# Use docker mount cache, with locked sharing to avoid concurrency issues.
@wodCZ
wodCZ / Dockerfile
Created August 2, 2022 13:25
Nest.js + Prisma Dockerfile - possibly smallest image size
FROM node:18-alpine as build
WORKDIR /app
RUN yarn global add @vercel/ncc
COPY package.json yarn.lock ./
RUN yarn install
COPY . .
RUN ./node_modules/.bin/prisma generate && yarn run build && ncc build dist/src/main.js -o build
@wodCZ
wodCZ / development-stage.Dockerfile
Created November 12, 2022 12:55
Node.js Dockerfiles
##################################
# Development stage
# This is not used at the moment, since the node_modules synchronization with host is complicated.
# Left here for future reference if we decide to run the app in docker during development.
##################################
FROM base as development
# Prepare the app directory and node user
@wodCZ
wodCZ / queues.module.ts
Created January 21, 2024 16:49
Nest separate Queue and Processor structure
import { Module } from '@nestjs/common';
import { BullModule, BullRootModuleOptions } from '@nestjs/bull';
import { QueuesService } from './queues.service';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { AppConfig } from '../config/schema';
@Module({
imports: [
BullModule.forRootAsync({
imports: [ConfigModule],