Skip to content

Commit 0f89c81

Browse files
author
Mubarak Imam
committed
chore(ci): add docker for frontend
- add docker configs for front-end - minor modification in styles.scss
1 parent 93301e1 commit 0f89c81

File tree

4 files changed

+77
-7
lines changed

4 files changed

+77
-7
lines changed

.docker/docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ version: '3'
22

33
volumes:
44
nestpoc_api:
5+
nestpoc_ui:
56

67
services:
78
backend:
@@ -18,3 +19,16 @@ services:
1819
- '3000:3000'
1920
environment:
2021
PORT: 3000
22+
23+
frontend:
24+
build:
25+
context: ../nestpoc-ui
26+
dockerfile: ./Dockerfile
27+
command: /bin/sh
28+
volumes:
29+
- nestpoc_ui:/home/node/app/node_modules
30+
- ../nestpoc-ui:/home/node/app
31+
ports:
32+
- ${UI_PORT}:80
33+
environment:
34+
PORT: 80

.gitlab-ci.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,29 @@ variables:
1616
# improved performance.
1717
DOCKER_DRIVER: overlay2
1818
CI_REGISTRY_PATH: $CI_REGISTRY/$CI_USERNAME/$CI_PROJECT_NAME
19+
CI_FRONTEND_IMAGE: nestpoc-ui
20+
CI_BACKEND_IMAGE: nestpoc-api
1921

2022
services:
2123
- docker:dind
2224

2325

2426
stages:
25-
- Build Docker Image
27+
- Build Backend Image
28+
- Build Frontend Image
2629
# - Push Image to Registry
2730

31+
before_script:
32+
- docker login -u $CI_USERNAME -p $CI_ACCESS_TOKEN $CI_REGISTRY
33+
2834
backend:
29-
stage: Build Docker Image
30-
before_script:
31-
- docker login -u $CI_USERNAME -p $CI_ACCESS_TOKEN $CI_REGISTRY
35+
stage: Build Backend Image
36+
script:
37+
- docker build -t $CI_REGISTRY_PATH/$CI_BACKEND_IMAGE:latest ./nestpoc-api
38+
- docker push $CI_REGISTRY_PATH/$CI_BACKEND_IMAGE:latest
39+
40+
frontend:
41+
stage: Build Frontend Image
3242
script:
33-
- docker build -t $CI_REGISTRY_PATH/$CI_BACKEND_IMG:latest ./nestpoc-api
34-
- docker push $CI_REGISTRY_PATH/$CI_BACKEND_IMG:latest
43+
- docker build -t $CI_REGISTRY_PATH/$CI_FRONTEND_IMAGE:latest ./nestpoc-ui
44+
- docker push $CI_REGISTRY_PATH/$CI_FRONTEND_IMAGE:latest

nestpoc-ui/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM node:10-alpine as build
2+
LABEL application="nestpoc-frontend"
3+
ENV NODE_ENV=production
4+
ENV APP_DIR=/home/node/app
5+
RUN npm install yarn @angular/cli ng-tailwindcss -g
6+
RUN mkdir -p ${APP_DIR}/node_modules && chown -R node:node ${APP_DIR}
7+
WORKDIR ${APP_DIR}
8+
USER node
9+
COPY --chown=node:node package.json yarn.lock ./
10+
RUN yarn add @angular-devkit/build-angular tailwindcss --dev
11+
RUN yarn install
12+
COPY --chown=node:node ./src ./src
13+
COPY --chown=node:node angular.json ng-tailwind.js tailwind.config.js tsconfig.json ./
14+
RUN yarn build --prod
15+
16+
FROM nginx:alpine as server
17+
RUN rm -rf /usr/share/nginx/html/*
18+
COPY --from=build /home/node/app/dist/nest-ui /usr/share/nginx/html
19+
20+
EXPOSE 80

nestpoc-ui/src/styles.scss

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
@tailwind preflight;
22

3-
@tailwind component;
3+
.container{
4+
width: 100%
5+
}
6+
7+
@media (min-width: 640px){
8+
.container{
9+
max-width: 640px
10+
}
11+
}
12+
13+
@media (min-width: 768px){
14+
.container{
15+
max-width: 768px
16+
}
17+
}
18+
19+
@media (min-width: 1024px){
20+
.container{
21+
max-width: 1024px
22+
}
23+
}
24+
25+
@media (min-width: 1280px){
26+
.container{
27+
max-width: 1280px
28+
}
29+
}
430

531
.appearance-none{
632
-webkit-appearance: none;

0 commit comments

Comments
 (0)