Skip to content

Commit

Permalink
Use Docker To Ship The Item API
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestang12 committed Jan 17, 2021
1 parent 98a1e36 commit 7ea8d71
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Start from base image 1.15.16
FROM golang:1.15.6

# Configure the repo url so it can configure the work directory
ENV REPO_URL=/Users/jamestang/Desktop/Project/bookstore-items-api

# ENV GOPATH=/Users/jamestang/go

ENV APP_PATH=${REPO_URL}

# Cpoy the entire source code from the current directory to $WORKPATH
ENV WORKPATH=${APP_PATH}/src
COPY src $WORKPATH
WORKDIR ${WORKPATH}

RUN go build -o items-api .

# Expose port 8090 to the world:
EXPOSE 8090

CMD ["./items-api"]


# Step
# docker build -t main .
# docker build -t items-api .
# docker run -p 8090:8090 -p 9200:9200 items-api:latest or docker run -p 8090:8090 items-api:latest

0 comments on commit 7ea8d71

Please sign in to comment.