Skip to content

Commit

Permalink
add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
firefart committed Oct 8, 2022
1 parent d6875f7 commit db17c1b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM golang:latest AS build-env
WORKDIR /src
ENV CGO_ENABLED=0
COPY go.mod /src/
RUN go mod download
COPY . .
RUN go build -a -o stunner -ldflags="-s -w" -gcflags="all=-trimpath=/src" -asmflags="all=-trimpath=/src"

FROM alpine:latest

RUN apk add --no-cache ca-certificates \
&& rm -rf /var/cache/*

RUN mkdir -p /app \
&& adduser -D stunner \
&& chown -R stunner:stunner /app

USER stunner
WORKDIR /app

COPY --from=build-env /src/stunner .

ENTRYPOINT [ "./stunner" ]

0 comments on commit db17c1b

Please sign in to comment.