-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
94 lines (76 loc) · 2.55 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Simple multi-stage build dockerfile to build a yarn project and serve it with port 80. Use vite for development.
# Build with: docker build -t starname-marketplace .
# Run with: docker run -p 8080:80 starname-marketplace
# Build stage
FROM node:16-buster AS build
ARG NODE_ENV=production
ARG PROTOBUF_VERSION=3.14.0
ENV GENERATE_SOURCEMAP=false
ENV REACT_APP_ENV=${NODE_ENV}
ENV PROTOC_FILENAME="protoc-${PROTOBUF_VERSION}-linux-x86_64.zip"
WORKDIR /app
COPY package.json yarn.lock ./
# Install dependencies of this app
# RUN apt update && apt upgrade -y && \
# apt install -y git wget zip protoc python3 make pkgconfig
RUN apt update && apt upgrade -y && \
apt install -y git wget zip python3 make pkg-config protobuf-compiler g++ gcc
RUN echo "Installing protoc ${PROTOBUF_VERSION}..." && \
echo "Protoc filename: ${PROTOC_FILENAME}" && \
echo "Protoc version: ${PROTOBUF_VERSION}" && \
echo "Protoc url: https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/${PROTOC_FILENAME}"
RUN wget "https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/${PROTOC_FILENAME}" && \
unzip ${PROTOC_FILENAME} -d /usr/local
# ENV PATH="$HOME/protoc/bin:$PATH"
# RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn global add \
RUN yarn global add \
mkdirp \
# protoc \
patch-package \
ts-proto \
# google-protobuf \
# eslint \
# eslint-plugin-react \
eslint \
prettier \
typescript \
eslint-plugin-react \
eslint-plugin-simple-import-sort \
@typescript-eslint/parser \
@typescript-eslint/parser \
@typescript-eslint/eslint-plugin \
eslint-config-prettier \
eslint-plugin-prettier \
react-scripts \
ts-jest \
--prefix /usr/local
# Install dependencies of lint https://typescript-eslint.io/getting-started/
# RUN yarn add -D \
# eslint-plugin-react \
# eslint-plugin-simple-import-sort \
# @typescript-eslint/parser \
# @typescript-eslint/parser \
# @typescript-eslint/eslint-plugin \
# eslint-config-prettier \
# eslint-plugin-prettier \
# react-scripts \
# ts-jest \
# eslint \
# prettier \
# enzyme-to-json \
# --prefix /usr/local
RUN protoc --version
COPY ./proto ./proto
# COPY ./patches ./patches
# Install the app
RUN env NODE_ENV=development yarn install
COPY . .
RUN yarn generate-types
RUN yarn lint
RUN yarn test
RUN yarn build
# Serve stage
FROM nginx:alpine
COPY --from=build /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]