ワンクリックで
go-project-scripts
Build scripts, Dockerfile, Docker Compose, and deployment configurations for Go projects
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Build scripts, Dockerfile, Docker Compose, and deployment configurations for Go projects
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | go-project-scripts |
| description | Build scripts, Dockerfile, Docker Compose, and deployment configurations for Go projects |
scripts/
├── build.sh # Cross-platform build script
├── Dockerfile # Multi-stage Docker build
├── entrypoint.sh # Container entrypoint with env support
└── compose.yaml # Docker Compose for local deployment
#!/bin/sh
set -e
cd "$(dirname "$0")/../"
OS=$(uname -s)
# Determine output binary name
case "$OS" in
*CYGWIN*|*MINGW*|*MSYS*)
OUTPUT="./build/memos.exe"
;;
*)
OUTPUT="./build/memos"
;;
esac
echo "Building for $OS..."
# Ensure build directories exist
mkdir -p ./build/.gocache ./build/.gomodcache
export GOCACHE="$(pwd)/build/.gochache"
export GOMODCACHE="$(pwd)/build/.gomodcache"
# Build the executable
go build -o "$OUTPUT" ./cmd/server
echo "Build successful: $OUTPUT"
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS backend
WORKDIR /backend-build
RUN apk add --no-cache git ca-certificates
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY . .
ARG TARGETOS TARGETARCH VERSION COMMIT
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build \
-trimpath \
-ldflags="-s -w -extldflags '-static'" \
-tags netgo,osusergo \
-o server \
./cmd/server
# Minimal runtime image
FROM alpine:3.21 AS monolithic
RUN apk add --no-cache tzdata ca-certificates && \
addgroup -g 10001 -S nonroot && \
adduser -u 10001 -S -G nonroot -h /var/opt/myapp nonroot && \
mkdir -p /var/opt/myapp && \
chown -R nonroot:nonroot /var/opt/myapp
COPY --from=backend /backend-build/server /usr/local/myapp/server
COPY --from=backend --chmod=755 /scripts/entrypoint.sh /usr/local/myapp/entrypoint.sh
USER nonroot:nonroot
WORKDIR /var/opt/myapp
VOLUME /var/opt/myapp
ENV TZ="UTC"
EXPOSE 8080
ENTRYPOINT ["/usr/local/myapp/entrypoint.sh", "/usr/local/myapp/server"]
#!/usr/bin/env sh
# Support for env files from secrets
file_env() {
var="$1"
fileVar="${var}_FILE"
val_var="$(printenv "$var")"
val_fileVar="$(printenv "$fileVar")"
if [ -n "$val_var" ] && [ -n "$val_fileVar" ]; then
echo "error: both $var and $fileVar are set (exclusive)" >&2
exit 1
fi
if [ -n "$val_var" ]; then
val="$val_var"
elif [ -n "$val_fileVar" ]; then
if [ ! -r "$val_fileVar" ]; then
echo "error: file '$val_fileVar' not readable" >&2
exit 1
fi
val="$(cat "$val_fileVar")"
fi
export "$var"="$val"
unset "$fileVar"
}
# Load env vars (supports *_FILE pattern for secrets)
file_env "MEMOS_DSN" # or your app's env var
exec "$@"
services:
myapp:
image: myapp:latest
container_name: myapp
volumes:
- ~/.myapp:/var/opt/myapp
ports:
- "8080:8080"
environment:
- MODE=prod
- DRIVER=sqlite
| Variable | Purpose |
|---|---|
MODE | dev/demo/prod |
DRIVER | sqlite/mysql/postgres |
DSN | Database connection string |
PORT | HTTP listen port |
DATA | Data directory |
*{VAR}_FILE | Load from file (for secrets) |
# Local build
./scripts/build.sh
./build/server
# Docker build
docker build -t myapp:latest -f scripts/Dockerfile .
# Docker run
docker run -p 8080:8080 -v ~/.myapp:/var/opt/myapp myapp:latest
# Docker Compose
docker compose -f scripts/compose.yaml up -d
| Pattern | Description |
|---|---|
| Multi-stage build | Minimal runtime image |
| Non-root user | Security best practice |
| ENV_FILE support | Secrets from mounted files |
| Volume for data | Persist database |
| Static binary | CGO_ENABLED=0 for portability |
This skill should be used when the user asks to generate or process images. Activates with phrases like generate image, create icon, make logo, design illustration, cut image, remove background. Provides image generation and processing capabilities via ComfyUI through n8n workflow service.
This skill should be used when the user asks to convert text to speech, generate audio, create TTS voice, or do voice synthesis. Activates with phrases like 语音合成, TTS, 文字转语音, 生成语音, 配音, 朗读. Provides text formatting, text splitting, TTS generation, and audio merging workflow.
Transform text content into professional Mermaid diagrams for presentations and documentation. Use when users ask to visualize concepts, create flowcharts, or make diagrams from text. Supports process flows, system architectures, comparisons, mindmaps, and more with built-in syntax error prevention.
This skill should be used when the user asks to understand new concepts or technologies. Activates with phrases like explain, teach, learn, concept, technology, how to, what is, understanding, tutorial, guide. Provides structured 5-step explanations following Problem-Based Learning principles: Scenario, Limitation, Concept, Core Mechanics, Implementation. Uses storytelling approach to create complete "problem-exploration-answer" cognitive loop with practical examples and code samples.
Automatically save chat conversations to individual markdown files with unique filenames containing timestamps. Each conversation is saved to /Users/pix/dev/code/ai/pixai/chat-history directory. Use when user wants to preserve chat history, save conversation logs, or maintain a record of discussions.
Automatically save chat conversations to individual markdown files with unique filenames containing timestamps. Each conversation is saved to /Users/pix/dev/code/ai/pixai/chat-history directory. Use when user wants to preserve chat history, save conversation logs, or maintain a record of discussions.