Skip to content

Commit d9687f6

Browse files
committed
Create docker configuration for the counter system
1 parent 8559f8d commit d9687f6

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

counter/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
counter

counter/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM golang
2+
3+
# if left blank app will run with dev settings
4+
# to build production image run:
5+
# $ docker build ./api --build-args app_env=production
6+
ARG app_env
7+
ENV APP_ENV $app_env
8+
9+
10+
COPY . /go/src/github.com/zucchinidev/building-distributed-system-golang/counter
11+
WORKDIR /go/src/github.com/zucchinidev/building-distributed-system-golang/counter
12+
13+
RUN go get ./
14+
RUN go build
15+
16+
# if dev setting will use pilu/fresh for code reloading via docker-compose volume sharing with local machine
17+
# if production setting will build binary
18+
CMD if [ ${APP_ENV} = production ]; \
19+
then \
20+
counter; \
21+
else \
22+
go get github.com/pilu/fresh && \
23+
fresh; \
24+
fi

0 commit comments

Comments
 (0)