Skip to content

Commit be80dbe

Browse files
author
romnnn
committed
Add dockerfile
1 parent 3057222 commit be80dbe

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

.dockerignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Ignore all
2+
*
3+
4+
# Unignore all with extensions
5+
!*.*
6+
7+
# Unignore all dirs
8+
!*/
9+
10+
# Unignore bazel files without extension
11+
!**/WORKSPACE
12+
!**/BUILD
13+
14+
# Unignore Dockerfile and other useful files
15+
!**/Dockerfile
16+
!**/.dockerignore
17+
!**/LICENSE
18+
19+
### Above combination will ignore all files without extension ###
20+
21+
.DS_Store
22+
.vscode/
23+
.idea/
24+
coverage*
25+
*.exe
26+
build/
27+
__pycache__/
28+
examples/

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
!**/WORKSPACE
1212
!**/BUILD
1313

14+
# Unignore Dockerfile and other useful files
15+
!**/Dockerfile
16+
!**/.dockerignore
17+
!**/LICENSE
18+
1419
### Above combination will ignore all files without extension ###
1520

1621
.DS_Store

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
FROM golang:alpine AS BUILD
3+
4+
LABEL maintainer="contact@romnn.com"
5+
6+
ENV GO111MODULE=on
7+
8+
WORKDIR /app
9+
COPY ./ /app
10+
11+
# This removes debug information from the binary
12+
# Assumes go 1.10+
13+
RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -ldflags="-w -s" -o app "github.com/romnnn/mongoimport/cmd/mongoimport"
14+
15+
FROM gcr.io/distroless/static
16+
COPY --from=BUILD /app/app /app
17+
ENTRYPOINT [ "/app" ]

0 commit comments

Comments
 (0)