🌟
z's
  • Hello
  • Cheatsheets
    • 🍂Docker Compose Services
    • 🌿Git
    • ▶️ Golang
      • Gotchas
    • ⛑️Helm
    • ☸️ Kubernetes Management
    • ☸️ Kubernetes Resources
    • ☸️Kubernetes Snippets
    • 🔨Tools Quicklinks
    • Tools and Useful Stuff
    • 🟠Using Ubuntu
    • Reference/Template Dockerfiles
  • How-Tos
    • Use Ubuntu
    • Use VSCode
    • Use AWS
    • Use Git
    • Use GPG keys
    • Use Digital Ocean
  • About Me
    • Want to work with me?
    • How to work with me
  • Useful Tools
    • Collaboration
      • Miro
    • Documentation
      • Gitbook
      • Notion
  • On Growing People
    • Ontological Coaching
    • Organization Development (OD)
    • Speech Acts
    • Books & Other Resources
  • On Creating Software
    • Product
    • Design
    • Development Environments
      • Introduction
      • Visual Studio Code/Codium
      • Public Key Infrastructure (PKI) Setup & Usage
    • Patterns
      • API Authentication
      • User Authentication
    • Languages/Formats
      • JavaScript
      • Golang
      • HTML
      • CSS
      • SQL
      • JSON
      • YAML
    • Code Logistics
    • Data Persistence
      • Cassandra
    • Software Architecture
    • System Observability
    • Cool Tools
    • Kubernetes
      • Resource Cheatsheet
      • 1/ Kubernetes in 5 Minutes
      • 2/ Setting up Kubernetes locally
      • 3/ Handling long-running workloads
      • 4/ Handling run-once workloads
Powered by GitBook
On this page
  • Golang
  • Node.js
  • Python

Was this helpful?

  1. Cheatsheets

Reference/Template Dockerfiles

Golang

  1. Change %_TODO_COMMAND_% to your command name

FROM golang:1.20-alpine AS builder
RUN apk update
RUN apk add ca-certificates make
WORKDIR /app
COPY ./go.mod ./go.mod
COPY ./go.sum ./go.sum
RUN go mod download
COPY ./internal ./internal
ARG COMMAND=%_TODO_COMMAND_%
COPY ./cmd/${COMMAND} ./cmd/${COMMAND}
RUN go mod vendor
ENV CGO_ENABLED=0
RUN go build \
  -ldflags "-extldflags 'static'" \
  -mod=vendor \
  -o ./bin/${COMMAND} \
  ./cmd/${COMMAND};

FROM scratch AS service
ARG COMMAND=%_TODO_COMMAND_%
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app/bin/${COMMAND} /entrypoint
ENTRYPOINT [ "/entrypoint" ]

Node.js

Python

PreviousUsing UbuntuNextUse Ubuntu

Last updated 1 year ago

Was this helpful?