-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
46 lines (35 loc) · 1.17 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
### This Dockerfile create for deploy to heroku #%@!
# UI image =====================================================================
FROM node:19-alpine AS build_ui
ARG REACT_APP_API_URL
ENV REACT_APP_API_URL=$REACT_APP_API_URL
WORKDIR /src
COPY ./ui ./
RUN \
echo "REACT_APP_API_URL=$REACT_APP_API_URL" >> .env && \
npm i && \
npm run build
# SERVER image =================================================================
FROM golang:1.20-alpine AS build_server
ENV GO111MODULE on
# Build project
WORKDIR /go/src
COPY ./server .
RUN CGO_ENABLED=0 \
GOOS=linux \
go build \
-a \
-mod vendor \
-installsuffix cgo \
-o app ./cmd/server
# Application image ============================================================
FROM nginx:1.23-alpine
ARG PORT=80
ENV PORT=$PORT
RUN apk add --update bash curl openssh python py-pip supervisor && \
pip install supervisor-stdout
WORKDIR /usr/share/nginx/html
COPY ./heroku/ops/root /
COPY --from=build_ui /src/build ./
COPY --from=build_server /go/src/app /app
CMD /bin/bash /heroku-exec.sh && /bin/bash -c "envsubst '\$PORT' < /etc/nginx/conf.d/default.conf > /etc/nginx/conf.d/default.conf" && supervisord -c /etc/supervisord.conf