-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (45 loc) · 1.06 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
#
# 1. Build Go App
#
FROM golang:1.16-alpine AS build-go
ENV GO111MODULE=on \
GOOS=linux \
GOARCH=amd64 \
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
RUN apk add build-base
WORKDIR /app/backend
COPY go.mod /app/backend
COPY go.sum /app/backend
RUN go mod download
COPY . /app/backend
RUN go build -o ./PilEk
#
# 2. Build Vue App
#
FROM node:lts-alpine as build-vue
WORKDIR /app/frontend
COPY client /app/frontend
RUN npm install
RUN npm run build
#
# 3. Runtime Container
#
FROM alpine
LABEL maintainer="Nayef Haidir <[email protected]>"
ENV TZ=Asia/Jakarta \
PATH="/app:${PATH}"
RUN apk add --update --no-cache \
sqlite \
tzdata \
ca-certificates \
bash \
&& \
cp --remove-destination /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo "${TZ}" > /etc/timezone
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
WORKDIR /app
COPY --from=build-vue /app/frontend/dist /app/dist/
COPY --from=build-go /app/backend/PilEk /app/
COPY --from=build-go /app/backend/voting.db /app/
EXPOSE 8080
CMD ["./PilEk"]