Skip to content

Commit 9885716

Browse files
committed
went to stage 2. changed yml to not include nginx
1 parent 3e0a763 commit 9885716

File tree

4 files changed

+35
-15
lines changed

4 files changed

+35
-15
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ jspm_packages/
8787
build/
8888
release-builds/
8989

90-
.docker-compose.yml
91-
.Dockerfile-2stage
90+
.docker-compose-nginx.yml
91+
.Dockerfile-1stage
9292
.Dockerfile-nginx
9393

9494
# TypeScript v1 declaration files

Dockerfile

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
1-
FROM node:19-alpine
1+
# Stage 1: Build
2+
FROM node:19-alpine as build
23

3-
#python: required dependency for node alpine, shrinks image size from 2.17GB to 1.67GB
4+
# python: required dependency for node alpine, shrinks image size from 2.17GB to 1.67GB
45
RUN apk add --no-cache --virtual .gyp \
56
python3 \
67
make \
7-
g++
8+
g++
89

910
WORKDIR /app
1011

1112
COPY package*.json ./
1213

13-
COPY app/dist /app
14+
RUN npm install --no-install-recommends
1415

15-
# COPY .env .env
16+
COPY . .
1617

17-
COPY server ./server
18+
# Stage 2: Runtime
19+
FROM node:19-alpine as runtime
1820

19-
COPY config.js ./config.js
21+
WORKDIR /app
2022

21-
RUN npm install --no-install-recommends
23+
COPY --from=build /app/package*.json ./
24+
25+
RUN npm install --no-install-recommends --only=production
26+
27+
COPY --from=build /app/.env .env
28+
COPY --from=build /app/config.js ./config.js
29+
COPY --from=build /app/server ./server
30+
COPY --from=build /app/app/dist /app
2231

2332
EXPOSE 5656
2433

2534
ENV IS_DOCKER true
2635

2736
CMD [ "npm", "start" ]
28-
29-
# create docker image: "docker build -t reactype-container ." Note: if you want reactype-container with a different name (must be all lowercase)
30-
# run docker container: "docker run -d -p 5656:5656 reactype-container" docker run -d -p 5656:5656 reactype-v15
31-
# comment out window.api.formatCode(), but will break it for electron app.

app/dist/index-prod.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html lang="en-US"><head><meta charset="UTF-8"/><script src="https://kit.fontawesome.com/7e1cebd082.js" crossorigin="anonymous"></script><meta property="csp-nonce" content="NTVhMWZiNjQtNTNiMi00NTE3LTkwMDItMTdmZWJlMzJkOTZk"/><title>ReacType</title><link href="main.css" rel="stylesheet"></head><body><div id="app"></div><script src="bundle.js"></script></body></html>
1+
<!doctype html><html lang="en-US"><head><meta charset="UTF-8"/><script src="https://kit.fontawesome.com/7e1cebd082.js" crossorigin="anonymous"></script><meta property="csp-nonce" content="MGMzMmNhN2QtOGMxZi00YTllLTlhODQtMGM0ZWMxYTE4ZGJh"/><title>ReacType</title><link href="main.css" rel="stylesheet"></head><body><div id="app"></div><script src="bundle.js"></script></body></html>

docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: '3'
2+
3+
services:
4+
web:
5+
build:
6+
context: .
7+
target: runtime
8+
ports:
9+
- '80:80'
10+
api:
11+
build:
12+
context: .
13+
target: build
14+
ports:
15+
- '5656:5656'

0 commit comments

Comments
 (0)