Skip to content

Commit

Permalink
dockerize
Browse files Browse the repository at this point in the history
  • Loading branch information
arpansaha13 authored and sadanandpai committed Aug 18, 2024
1 parent ead802c commit f86eec0
Show file tree
Hide file tree
Showing 23 changed files with 281 additions and 1 deletion.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM frontend-mini-challenges-shared-assets AS shared-assets
FROM frontend-mini-challenges-shared-data AS shared-data
FROM frontend-mini-challenges-shared-styles AS shared-styles

FROM node:22 AS root

WORKDIR /app

COPY --from=shared-assets /shared/assets /app/shared/assets

COPY --from=shared-data /shared/data /app/shared/data

COPY --from=shared-styles /shared/styles /app/shared/styles

COPY package*.json .

COPY .npmrc .

COPY tsconfig.json .
4 changes: 4 additions & 0 deletions apps/angular/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
build
Dockerfile
21 changes: 21 additions & 0 deletions apps/angular/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM frontend-mini-challenges-root AS root

FROM node:22

COPY --from=root /app /app

WORKDIR /app/apps/angular

COPY package*.json .

WORKDIR /app

RUN npm install

WORKDIR /app/apps/angular

COPY . .

EXPOSE 6015

CMD [ "npm", "run", "dev" ]
4 changes: 4 additions & 0 deletions apps/css/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
build
Dockerfile
21 changes: 21 additions & 0 deletions apps/css/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM frontend-mini-challenges-root AS root

FROM node:22

COPY --from=root /app /app

WORKDIR /app/apps/css

COPY package*.json .

WORKDIR /app

RUN npm install

WORKDIR /app/apps/css

COPY . .

EXPOSE 6011

CMD [ "npm", "run", "dev" ]
1 change: 1 addition & 0 deletions apps/css/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default defineConfig({
},
server: {
port: 6011,
host: true,
strictPort: true,
},
base: '/frontend-mini-challenges/css/',
Expand Down
4 changes: 4 additions & 0 deletions apps/host/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
build
Dockerfile
21 changes: 21 additions & 0 deletions apps/host/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM frontend-mini-challenges-root AS root

FROM node:22

COPY --from=root /app /app

WORKDIR /app/apps/host

COPY package*.json .

WORKDIR /app

RUN npm install

WORKDIR /app/apps/host

COPY . .

EXPOSE 6010

CMD [ "npm", "run", "dev" ]
3 changes: 2 additions & 1 deletion apps/host/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ export default defineConfig({
},
server: {
port: 6010,
// open: true,
host: true,
strictPort: true,
open: true,
},
base: '/frontend-mini-challenges/',
});
4 changes: 4 additions & 0 deletions apps/javascript/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
build
Dockerfile
21 changes: 21 additions & 0 deletions apps/javascript/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM frontend-mini-challenges-root AS root

FROM node:22

COPY --from=root /app /app

WORKDIR /app/apps/javascript

COPY package*.json .

WORKDIR /app

RUN npm install

WORKDIR /app/apps/javascript

COPY . .

EXPOSE 6012

CMD [ "npm", "run", "dev" ]
1 change: 1 addition & 0 deletions apps/javascript/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default defineConfig({
},
server: {
port: 6012,
host: true,
strictPort: true,
},
base: '/frontend-mini-challenges/javascript/',
Expand Down
4 changes: 4 additions & 0 deletions apps/react/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
build
Dockerfile
21 changes: 21 additions & 0 deletions apps/react/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM frontend-mini-challenges-root AS root

FROM node:22

COPY --from=root /app /app

WORKDIR /app/apps/react

COPY package*.json .

WORKDIR /app

RUN npm install

WORKDIR /app/apps/react

COPY . .

EXPOSE 6013

CMD [ "npm", "run", "dev" ]
1 change: 1 addition & 0 deletions apps/react/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default defineConfig({
},
server: {
port: 6013,
host: true,
strictPort: true,
},
base: '/frontend-mini-challenges/react/',
Expand Down
4 changes: 4 additions & 0 deletions apps/vue/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
build
Dockerfile
21 changes: 21 additions & 0 deletions apps/vue/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM frontend-mini-challenges-root AS root

FROM node:22

COPY --from=root /app /app

WORKDIR /app/apps/vue

COPY package*.json .

WORKDIR /app

RUN npm install

WORKDIR /app/apps/vue

COPY . .

EXPOSE 6014

CMD [ "npm", "run", "dev" ]
1 change: 1 addition & 0 deletions apps/vue/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default defineConfig({
},
server: {
port: 6014,
host: true,
strictPort: true,
},
base: '/frontend-mini-challenges/vue/',
Expand Down
84 changes: 84 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
services:
shared-assets:
build: ./shared/assets
container_name: shared-assets

shared-data:
build: ./shared/data
container_name: shared-data

shared-styles:
build: ./shared/styles
container_name: shared-styles

root:
build: ./
container_name: root
depends_on:
- shared-assets
- shared-data
- shared-styles

host:
build: ./apps/host
container_name: host
ports:
- 6010:6010
env_file:
- ./docker-env/.env
stdin_open: true
tty: true
depends_on:
- root

css:
build: ./apps/css
container_name: css
ports:
- 6011:6011
env_file:
- ./docker-env/.env
depends_on:
- root

javascript:
build: ./apps/javascript
container_name: javascript
ports:
- 6012:6012
env_file:
- ./docker-env/.env
depends_on:
- root

react:
build: ./apps/react
container_name: react
ports:
- 6013:6013
stdin_open: true
tty: true
env_file:
- ./docker-env/.env
depends_on:
- root

vue:
build: ./apps/vue
container_name: vue
ports:
- 6014:6014
env_file:
- ./docker-env/.env
depends_on:
- root

angular:
build: ./apps/angular
container_name: angular
ports:
- 6015:6015
env_file:
- ./docker-env/.env
depends_on:
- root
7 changes: 7 additions & 0 deletions docker-env/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
VITE_PATH=frontend-mini-challenges
VITE_HOST_URL=http://localhost:6010/
VITE_CSS_APP_URL=http://localhost:6011/
VITE_JS_APP_URL=http://localhost:6012/
VITE_REACT_APP_URL=http://localhost:6013/
VITE_VUE_APP_URL=http://localhost:6014/
VITE_NG_APP_URL=http://localhost:6015/
5 changes: 5 additions & 0 deletions shared/assets/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:22

WORKDIR /shared/assets

COPY . .
5 changes: 5 additions & 0 deletions shared/data/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:22

WORKDIR /shared/data

COPY . .
5 changes: 5 additions & 0 deletions shared/styles/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:22

WORKDIR /shared/styles

COPY . .

0 comments on commit f86eec0

Please sign in to comment.