Skip to content

Commit b149bde

Browse files
committed
add missing Dockerfile
1 parent 984a7dc commit b149bde

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

website/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM golang:1.22.5-alpine AS builder
2+
RUN adduser -D -g '' elf
3+
WORKDIR /opt/app/
4+
COPY go.mod go.sum ./
5+
RUN go mod download && go mod verify
6+
COPY . .
7+
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -a -installsuffix cgo -o /go/bin/cinema-website ./cmd/app
8+
9+
# build smaller image
10+
FROM alpine:3.17.3
11+
LABEL language="golang"
12+
LABEL org.containers.image.source="https://github.com/mikebellcoder/microservices-docker-go-mongodb"
13+
COPY --from=builder /etc/passwd /etc/passwd
14+
COPY --from=builder --chown=elf:1000 /go/bin/cinema-website /cinema-website
15+
USER elf
16+
ENTRYPOINT [ "./cinema-website" ]

0 commit comments

Comments
 (0)