-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (27 loc) · 923 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
FROM golang:1.20.4-bullseye as build-backend
ARG SKIP_BACKEND_TEST=1
ADD backend /build/backend
WORKDIR /build/backend
RUN echo go version: `go version`
ENV GOFLAGS="-mod=vendor"
# run tests
RUN \
if [ -z "$SKIP_BACKEND_TEST" ] ; then \
go test -race -p 1 -timeout="${BACKEND_TEST_TIMEOUT:-300s}" -covermode=atomic ./... ; \
else \
echo "skip backend tests and linter" \
; fi
RUN go build -o app ./cmd/server
FROM node:19.9.0-alpine AS build-frontend
WORKDIR /build/frontend
COPY ./frontend/package*.json ./frontend/vue.config.js /build/frontend/
COPY ./frontend/public /build/frontend/public
RUN npm install
COPY ./frontend/src /build/frontend/src
RUN npm run build
FROM golang:1.20.4-bullseye
WORKDIR /srv/webdict
EXPOSE ${PORT}
COPY --from=build-frontend /build/frontend/target/dist /srv/webdict/public
COPY --from=build-backend /build/backend/app /srv/webdict/app
CMD ["/srv/webdict/app"]