docker-compose setup

This commit is contained in:
2020-01-03 16:37:51 -05:00
parent bbec2d8ccf
commit 017ed14462
7 changed files with 58 additions and 59 deletions

View File

@@ -1,5 +1,5 @@
# Build API
FROM golang:1.11.5 as go_build
FROM golang:1.13 as go_build
WORKDIR /go/src/github.com/simon987/task_tracker/
COPY .git .git
@@ -10,17 +10,11 @@ COPY main main
COPY storage storage
RUN go get ./main/ && GOOS=linux CGO_ENABLED=0 go build -a -installsuffix cgo -o tt_api ./main/
# Build Web
FROM node:10-alpine as npm_build
COPY ./web/ ./
RUN cd ./angular/ && npm install
RUN cd ./angular/ && ./node_modules/@angular/cli/bin/ng build --prod --optimization --output-path "/webroot"
FROM scratch
FROM nginx:alpine
WORKDIR /root
WORKDIR /root/
COPY nginx.conf schema.sql config.yml ./
COPY --from=go_build ["/go/src/github.com/simon987/task_tracker/tt_api", "./"]
COPY --from=npm_build ["/webroot", "/webroot"]
COPY --from=go_build ["/go/src/github.com/simon987/task_tracker/tt_api", "/root/"]
COPY ["config.yml", "schema.sql", "/root/"]
CMD ["sh", "-c", "nginx -c /root/nginx.conf && /root/tt_api"]
CMD ["/root/tt_api"]