forked from akash-network/awesome-akash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (51 loc) · 1.77 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
# ---------------------------------------
# Base image for node
FROM node:19-slim as node_base
WORKDIR /usr/src/app
# ---------------------------------------
# Base image for runtime
FROM python:3.11-slim as base
ENV TZ=Etc/UTC
WORKDIR /usr/src/app
# Install Redis
RUN apt-get update \
&& apt-get install -y curl wget gnupg cmake lsb-release build-essential \
&& curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list \
&& apt-get update \
&& apt-get install -y redis \
&& mkdir -p /etc/redis /var/redis \
&& pip install --upgrade pip
# Add redis config
COPY ./serge/config/redis.conf /etc/redis/redis.conf
# ---------------------------------------
# Dev environment
FROM base as dev
ENV NODE_ENV='development'
# Install Node.js and npm packages
COPY --from=node_base /usr/local /usr/local
COPY ./serge/web/package*.json ./
RUN npm ci
COPY --chmod=0755 scripts/dev.sh /usr/src/app/dev.sh
CMD ./dev.sh
# ---------------------------------------
# Build frontend
FROM node_base as frontend_builder
COPY ./serge/web/package*.json ./
RUN npm ci
COPY ./serge/web /usr/src/app/web/
WORKDIR /usr/src/app/web/
RUN npm run build
# ---------------------------------------
# Runtime environment
FROM base as release
ENV NODE_ENV='production'
WORKDIR /usr/src/app
COPY --from=frontend_builder /usr/src/app/web/build /usr/src/app/api/static/
COPY ./serge/api /usr/src/app/api
COPY --chmod=0755 serge/scripts/deploy.sh /usr/src/app/deploy.sh
RUN pip install --no-cache-dir ./api
RUN mkdir -p /data/db
RUN mkdir -p /usr/src/app/weights
EXPOSE 8008
CMD ./deploy.sh