-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (37 loc) · 952 Bytes
/
Dockerfile
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
41
42
43
44
45
46
47
48
49
# Gobuilder
FROM golang:alpine as gobuilder
RUN apk add --no-cache git make
RUN mkdir -p /go/src/habits
WORKDIR /go/src/habits
COPY Makefile .
COPY go.mod .
COPY go.sum .
COPY cmd ./cmd
COPY database ./database
COPY internal ./internal
RUN make install
RUN make build-api-production
# Jsbuilder
FROM node:lts-alpine as jsbuilder
RUN apk add --no-cache make
WORKDIR /app
COPY package*.json ./
ENV NODE_ENV=production
RUN npm install --no-optional
COPY babel.config.js .
COPY vue.config.js .
COPY Makefile .
COPY web/src ./web/src
COPY web/public ./web/public
RUN make build-js-production
# Final image
FROM alpine
ARG COMMIT
WORKDIR /app
COPY --from=gobuilder /go/src/habits/bin/* .
COPY --from=gobuilder /go/src/habits/database ./database
COPY --from=jsbuilder /app/web/dist ./web/dist
RUN echo ${COMMIT} > ./web/dist/version
EXPOSE 80
ENV HABITS_ENVIRONMENT=production
CMD ["./habits", "serve"]