Skip to content

Commit

Permalink
Merge pull request #24 from NBISweden/feature/docker
Browse files Browse the repository at this point in the history
Add docker stuff
  • Loading branch information
viklund authored Nov 16, 2020
2 parents 2d1a38a + d7f1dd4 commit cf6ab3f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.github/
data/
datasecond/
docker-compose.yml
READNE.md
main
config.yaml
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM golang:1.15.5-alpine3.12
RUN apk add --no-cache git
COPY . .
ENV GO111MODULE=on
ENV GOPATH=$PWD
ENV CGO_ENABLED=0
ENV GOOS=linux
RUN go build -ldflags "-extldflags -static" -o ./build/svc .
RUN echo "nobody:x:65534:65534:nobody:/:/sbin/nologin" > passwd

FROM scratch
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=0 /go/build/svc svc
COPY --from=0 /go/passwd /etc/passwd
USER 65534
EXPOSE 8080
ENTRYPOINT [ "/svc" ]
5 changes: 5 additions & 0 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -xe
docker build \
--build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--build-arg "SOURCE_COMMIT=${SOURCE_COMMIT}" \
-t ${IMAGE_NAME} .

0 comments on commit cf6ab3f

Please sign in to comment.