forked from zekroTJA/shinpuru
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
59 lines (51 loc) · 1.53 KB
/
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
50
51
52
53
54
55
56
57
58
59
# ------------------------------------------------------------
# --- STAGE 1: Build Backend and Go Tools
FROM golang:1.18-alpine AS build-be
WORKDIR /build
# Copy source files
COPY cmd cmd
COPY internal internal
COPY pkg pkg
COPY go.mod .
COPY go.sum .
# Get go packages
RUN go mod download
# Build shinpuru backend
RUN go build -o ./bin/shinpuru ./cmd/shinpuru/main.go
# ------------------------------------------------------------
# --- STAGE 2.1: Build Web App Package
FROM node:16-alpine AS build-fe
WORKDIR /build
# Copy web source files
COPY web .
# Get dependencies
RUN yarn
# Build static web app files
RUN npx ng build --configuration production \
--output-path dist
# ------------------------------------------------------------
# --- STAGE 2.2: Build Web App Package
FROM node:16-alpine AS build-fenew
WORKDIR /build
# Copy web source files
COPY web.new .
# Get dependencies
RUN yarn
# Build static web app files
RUN yarn build --base=/beta/ --outDir=dist
# ------------------------------------------------------------
# --- STAGE 3: Final runtime environment
FROM alpine:3 AS final
WORKDIR /app
# Copy build artifacts from previous stages
COPY --from=build-be /build/bin .
COPY --from=build-fe /build/dist web/dist/web
COPY --from=build-fenew /build/dist web.new/dist/web
# Add CA certificates
RUN apk add ca-certificates
# Prepare directories
RUN mkdir -p /etc/config \
&& mkdir -p /etc/db
EXPOSE 8080
ENTRYPOINT ["/app/shinpuru", "-docker"]
CMD ["-c", "/etc/config/config.yml"]