Skip to content

Commit b3a6288

Browse files
author
Ben Turbes
committed
update build process/script
1 parent f9f5dcc commit b3a6288

File tree

6 files changed

+14
-20
lines changed

6 files changed

+14
-20
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
bin/
12
vendor/
23
demo_api
34
demo.db

Diff for: Dockerfile

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
FROM golang
1+
FROM debian:stable-slim
22

3-
RUN mkdir -p /go/src/github.com/bturbes/demo_api
4-
WORKDIR /go/src/github.com/bturbes/demo_api
3+
COPY bin/demo_api.linux /usr/local/bin/demo_api
54

6-
COPY . /go/src/github.com/bturbes/demo_api
7-
RUN go build
8-
9-
CMD [ "demo_api" ]
5+
CMD [ "/usr/local/bin/demo_api" ]

Diff for: Dockerfile.prod

-5
This file was deleted.

Diff for: build.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash -e
2+
3+
TAG=$1
4+
IMAGE_NAME="bturbes/demo_api:${TAG:-latest}"
5+
6+
mkdir -p bin
7+
docker run --rm -v "$PWD":/go/src/github.com/bturbes/demo_api -w /go/src/github.com/bturbes/demo_api golang:1.9 go build -o bin/demo_api.linux
8+
9+
docker build -t "$IMAGE_NAME" .

Diff for: docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '2'
22
services:
33
web:
4-
image: golang
4+
image: golang:1.9
55
command: sh -c "go build && ./demo_api"
66
ports:
77
- "8080:8080"

Diff for: prod_build.sh

-7
This file was deleted.

0 commit comments

Comments
 (0)