mirror of
https://github.com/agresdominik/dev-templates.git
synced 2026-04-21 10:01:57 +00:00
Base Templates
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 Dominik Agres
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# For testing
|
||||||
|
|
||||||
|
FROM golang:1.24-alpine AS builder
|
||||||
|
# FROM node:22-alpine AS builder
|
||||||
|
# FROM python:3.12-alpine AS builder
|
||||||
|
# FROM eclipse-temurin:21-jdk-alpine AS builder
|
||||||
|
# FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS builder
|
||||||
|
# FROM rust:1.81-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN apk add --no-cache make
|
||||||
|
RUN make install
|
||||||
|
|
||||||
|
# CMD ["ls"]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
container_name: name
|
||||||
|
image: imagename:imagetag
|
||||||
|
|
||||||
|
restart: unless-stopped # no | on-failure | always | unless-stopped
|
||||||
|
|
||||||
|
environment:
|
||||||
|
APP_ENV: development
|
||||||
|
APP_DEBUG: "false"
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- "8080:80" # http://localhost:8080 -> container 80
|
||||||
|
# or:
|
||||||
|
network_mode: host
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- /absolute/host/path:/container/path
|
||||||
|
|
||||||
|
# Service dependencies
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
.PHONY ...
|
||||||
|
|
||||||
|
DOCKER_NAME = project:name
|
||||||
|
PACKAGES = ./src/.
|
||||||
|
|
||||||
|
docker: # build a dockerfile in same dir and shell into it
|
||||||
|
docker build -t $(DOCKER_NAME) .
|
||||||
|
docker run -it --rm $(DOCKER_NAME) /bin/sh
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
.PHONY ...
|
||||||
|
|
||||||
|
EXECUTABLE = cheatsh
|
||||||
|
PACKAGES = ./src/.
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
build:
|
||||||
|
@mkdir -p bin
|
||||||
|
go build -o bin/$(EXECUTABLE) $(PACKAGES)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf bin/
|
||||||
|
|
||||||
|
docker:
|
||||||
|
docker build -t cheatsh-test .
|
||||||
|
docker run -it --rm cheatsh-test /bin/sh
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
.PHONY: all run test
|
||||||
|
|
||||||
|
SRC := ./src
|
||||||
|
VENV := .venv
|
||||||
|
|
||||||
|
RUNNER := $(VENV)/bin/python
|
||||||
|
TESTER := $(VENV)/bin/pytest
|
||||||
|
|
||||||
|
run:
|
||||||
|
$(RUNNER) $(SRC)/main.py
|
||||||
|
|
||||||
|
test:
|
||||||
|
$(TESTER) $(SRC)/main.py
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
.PHONY ...
|
||||||
|
|
||||||
|
EXECUTABLE = cheatsh
|
||||||
|
PACKAGES = ./src/.
|
||||||
|
SYSCONFDIR = $(HOME)/.config/cheatsh
|
||||||
|
PREFIX ?= $(HOME)/.local
|
||||||
|
|
||||||
|
build:
|
||||||
|
# build block
|
||||||
|
|
||||||
|
install: build
|
||||||
|
|
||||||
|
@echo "Installing binary in $(PREFIX)"
|
||||||
|
install -Dm755 bin/$(EXECUTABLE) $(PREFIX)/bin/$(EXECUTABLE)
|
||||||
|
|
||||||
|
@echo "Copying config files to $(SYSCONFDIR)"
|
||||||
|
install -Dm644 data/commands.json $(SYSCONFDIR)/commands.json
|
||||||
|
install -Dm644 data/commands_template.json $(SYSCONFDIR)/commands_template.json
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(PREFIX)/bin/$(EXECUTABLE)
|
||||||
|
rm -rf $(SYSCONFDIR)
|
||||||
Reference in New Issue
Block a user