-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile.volume
40 lines (27 loc) · 947 Bytes
/
Dockerfile.volume
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Dockerfile References: https://docs.docker.com/engine/reference/builder/
# Start from golang v1.11 base image
FROM golang:1.11
# Add Maintainer Info
LABEL maintainer="easierway <easierway@gmail.com>"
# Build Args
ARG APP_NAME=go-docker
ARG LOG_DIR=/${APP_NAME}/logs
# Create Log Directory
RUN mkdir -p ${LOG_DIR}
# Environment Variables
ENV LOG_FILE_LOCATION=${LOG_DIR}/app.log
# Set the Current Working Directory inside the container
WORKDIR ~/go-docker
# Copy everything from the current directory to the PWD(Present Working Directory) inside the container
COPY . .
# Download all the dependencies
# https://stackoverflow.com/questions/28031603/what-do-three-dots-mean-in-go-command-line-invocations
RUN go get -d -v ./...
# Install the package
RUN go install -v ./...
# This container exposes port 8080 to the outside world
EXPOSE 8080
# Declare volumes to mount
VOLUME ["/go-docker/logs"]
# Run the executable
CMD ["go-docker"]