Compare commits
7 Commits
release/0.
...
main
Author | SHA1 | Date | |
---|---|---|---|
8eeea51f71 | |||
dc897a5464 | |||
5c91325772 | |||
c7250311cf | |||
6a21114ffb | |||
cfa483a011 | |||
d5c73e8df6 |
17
Dockerfile
17
Dockerfile
@ -1,10 +1,8 @@
|
|||||||
# specify the base image to be used for the application
|
# Build stage
|
||||||
FROM golang:1.21.4-alpine
|
FROM golang:1.21.4-alpine AS builder
|
||||||
|
|
||||||
# create the working directory in the image
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# copy Go modules and dependencies to image
|
|
||||||
COPY go.mod ./
|
COPY go.mod ./
|
||||||
|
|
||||||
# download Go modules and dependencies
|
# download Go modules and dependencies
|
||||||
@ -13,11 +11,14 @@ RUN go mod download
|
|||||||
# copy all the Go files ending with .go extension
|
# copy all the Go files ending with .go extension
|
||||||
COPY *.go ./
|
COPY *.go ./
|
||||||
|
|
||||||
# compile application
|
RUN go build -o golang-http-header
|
||||||
RUN go build -o /golang-http-header
|
|
||||||
|
# Final stage
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=builder /app/golang-http-header /
|
||||||
|
|
||||||
# network port at runtime
|
# network port at runtime
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# execute when the container starts
|
CMD ["/golang-http-header"]
|
||||||
CMD [ "/golang-http-header" ]
|
|
@ -8,6 +8,7 @@ apiVersion: apps/v1
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: http-header
|
name: http-header
|
||||||
|
namespace: golang
|
||||||
labels:
|
labels:
|
||||||
app: golang
|
app: golang
|
||||||
spec:
|
spec:
|
||||||
@ -22,7 +23,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: http-header
|
- name: http-header
|
||||||
image: git.kcrawford.net/kcrawford/golang-http-header:0.0.5
|
image: git.kcrawford.net/kcrawford/golang-http-header:0.0.3
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user