Skip to content
This repository was archived by the owner on Sep 23, 2021. It is now read-only.

Commit ae63721

Browse files
committed
Update docker file to support go modules build.
1 parent 9857e3d commit ae63721

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ Readme.md
66
slides/
77
node_modules/
88
vendor/
9-
*.go

Dockerfile

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
FROM golang:1.12 AS compiler
2+
3+
WORKDIR $GOPATH/src/github.com/msoedov/hacker-slides
4+
5+
ENV GO111MODULE on
6+
COPY . .
7+
RUN GOOS=linux CGO_ENABLE=0 go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o app *.go
8+
RUN cp app /bin/app
9+
10+
111
FROM alpine:3.8
212

3-
WORKDIR /app
13+
WORKDIR /srv
414

5-
COPY . /app
615
ENV GIN_MODE=release
7-
8-
CMD ./main $PORT
16+
RUN mkdir slides
17+
COPY --from=compiler /bin/app /bin/app
18+
COPY static static
19+
COPY templates templates
20+
COPY initial-slides.md initial-slides.md
21+
CMD app $PORT

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ repo:
77
@echo $(DOCKER_IMAGE)
88

99
build:
10-
@GOOS=linux CGO_ENABLE=0 go build main.go
1110
@docker build -t $(DOCKER_IMAGE) .
1211
@docker tag $(DOCKER_IMAGE) $(REPO)
1312

0 commit comments

Comments
 (0)