summaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorMikkel Thestrup <mikkel_thestrup@mithe.dk>2025-12-06 23:20:13 +0100
committerMikkel Thestrup <mikkel_thestrup@mithe.dk>2025-12-06 23:20:13 +0100
commitd243b30606673baec988c5cd0a31e450f2794ca4 (patch)
treea9bee187e9b968fe5a13e048a1c222c4d448094c /Dockerfile
parent94646c018dfc87a7f1f9e11dc3e85d1af57899f0 (diff)
downloadweb-portfolio-d243b30606673baec988c5cd0a31e450f2794ca4.tar.gz
web-portfolio-d243b30606673baec988c5cd0a31e450f2794ca4.zip
Containerize the webserver
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile18
1 files changed, 18 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..a5d236c
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,18 @@
+# build
+FROM golang:1.25.4-alpine AS builder
+WORKDIR /app
+COPY go.mod go.sum ./
+RUN go mod download
+COPY . .
+RUN CGO_ENABLED=0 GOOS=linux go build -o main ./cmd/main.go
+
+# run
+FROM alpine:latest
+WORKDIR /app
+COPY --from=builder /app/main .
+COPY --from=builder /app/views ./views
+COPY --from=builder /app/css ./css
+COPY --from=builder /app/js ./js
+
+EXPOSE 8080
+CMD ["./main"]