Init
Some checks failed
Build & Deploy Game / build-and-deploy (push) Failing after 6s
Some checks failed
Build & Deploy Game / build-and-deploy (push) Failing after 6s
This commit is contained in:
37
Dockerfile
Normal file
37
Dockerfile
Normal file
@@ -0,0 +1,37 @@
|
||||
# --- STAGE 1: Builder (Kompilieren) ---
|
||||
FROM golang:1.23-alpine AS builder
|
||||
|
||||
# Arbeitsverzeichnis im Container erstellen
|
||||
WORKDIR /app
|
||||
|
||||
# Abhängigkeiten kopieren und herunterladen (Caching-Effizienz)
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Den gesamten Rest des Codes kopieren
|
||||
COPY . .
|
||||
|
||||
# Das Go-Programm kompilieren
|
||||
# -o server: Nenne die Datei "server"
|
||||
RUN go build -o server main.go
|
||||
|
||||
# --- STAGE 2: Runner (Ausführen) ---
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
# Wir brauchen evtl. Zertifikate für HTTPS (falls du später externe APIs nutzt)
|
||||
RUN apk --no-cache add ca-certificates
|
||||
|
||||
# Kopiere das fertige Programm aus Stage 1
|
||||
COPY --from=builder /app/server .
|
||||
|
||||
# WICHTIG: Kopiere die statischen Ordner (HTML, CSS, Bilder, Fonts, Admin)
|
||||
COPY --from=builder /app/static ./static
|
||||
COPY --from=builder /app/secure ./secure
|
||||
|
||||
# Port freigeben
|
||||
EXPOSE 8080
|
||||
|
||||
# Startbefehl
|
||||
CMD ["./server"]
|
||||
Reference in New Issue
Block a user