Skip to content

Commit

Permalink
refactor: edit the docker compose files to reflect the new folder str…
Browse files Browse the repository at this point in the history
…ucture. only on docker container for elements and sdk needed.
  • Loading branch information
like-a-bause committed Nov 10, 2022
1 parent a37219a commit 3169023
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 39 deletions.
8 changes: 1 addition & 7 deletions deploy/docker-compose/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,11 @@ services:
networks:
- intranet
elements:
build: ../../elements
build: ../../frontend
ports:
- "9500:80"
networks:
- intranet
frontendsdk:
build: ../../frontend-sdk
ports:
- "9501:80"
networks:
- intranet
mailslurper:
image: marcopas/docker-mailslurper:latest
ports:
Expand Down
10 changes: 2 additions & 8 deletions deploy/docker-compose/quickstart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,11 @@ services:
networks:
- intranet
elements:
build: ../../elements
build: ../../frontend
ports:
- "9500:80"
networks:
- intranet
frontendsdk:
build: ../../frontend-sdk
ports:
- "9501:80"
networks:
- intranet
quickstart:
build: ../../quickstart
ports:
Expand All @@ -66,7 +60,7 @@ services:
- HANKO_URL=http://localhost:8000
- HANKO_URL_INTERNAL=http://hanko:8000
- HANKO_ELEMENT_URL=http://localhost:9500/element.hanko-auth.js
- HANKO_FRONTEND_SDK_URL=http://localhost:9501/sdk.umd.js
- HANKO_FRONTEND_SDK_URL=http://localhost:9500/sdk.umd.js
networks:
- intranet
mailslurper:
Expand Down
31 changes: 31 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM node:16.16-alpine as build

WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH

# frontend-sdk
COPY frontend-sdk/package.json frontend-sdk/
COPY frontend-sdk/package-lock.json frontend-sdk/

WORKDIR /app/frontend-sdk
RUN npm ci --silent
COPY frontend-sdk/ ./
RUN npm run build


# elements
WORKDIR /app/elements
COPY elements/package.json ./
COPY elements/package-lock.json ./

RUN npm ci
COPY ./elements ./
RUN npm run build

FROM nginx:stable-alpine
COPY --from=build /app/elements/dist/element.hanko-auth.js /usr/share/nginx/html
COPY --from=build /app/frontend-sdk/dist/sdk.* /usr/share/nginx/html

COPY elements/nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
31 changes: 31 additions & 0 deletions frontend/Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM node:16.16-alpine as build

WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH

# frontend-sdk
COPY frontend-sdk/package.json frontend-sdk/
COPY frontend-sdk/package-lock.json frontend-sdk/

WORKDIR /app/frontend-sdk
RUN npm ci --silent
COPY frontend-sdk/ ./
RUN npm run build


# elements
WORKDIR /app/elements
COPY elements/package.json ./
COPY elements/package-lock.json ./

RUN npm ci
COPY ./elements ./
RUN npm run build:dev

FROM nginx:stable-alpine
COPY --from=build /app/elements/dist/element.hanko-auth.js /usr/share/nginx/html
COPY --from=build /app/frontend-sdk/dist/sdk.* /usr/share/nginx/html

COPY elements/nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
14 changes: 11 additions & 3 deletions frontend/elements/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ FROM node:16.16-alpine as build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH

COPY package.json ./
COPY package-lock.json ./
# Build SDK dependency
COPY ../frontend-sdk/package.json ../frontend-sdk/
COPY ../frontend-sdk/package-lock.json ../frontend-sdk/

RUN npm ci --silent ../frontend-sdk
COPY ../frontend-sdk/ ../frontend-sdk
RUN npm run build ../frontend-sdk

COPY elements/package.json ./
COPY elements/package-lock.json ./

RUN npm ci --silent
COPY . ./
Expand All @@ -13,6 +21,6 @@ RUN npm run build
FROM nginx:stable-alpine
COPY --from=build /app/dist/element.hanko-auth.js /usr/share/nginx/html

COPY nginx/default.conf /etc/nginx/conf.d/default.conf
COPY elements/nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
72 changes: 51 additions & 21 deletions frontend/elements/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3169023

Please sign in to comment.