Skip to content

Commit 2cd7647

Browse files
committed
setup basic dockerfile file
1 parent 7419a70 commit 2cd7647

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

Diff for: .docker/.config/nginx.conf

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
server {
2+
listen 80;
3+
location / {
4+
root /usr/share/nginx/html;
5+
index index.html index.htm;
6+
try_files $uri $uri/ /index.html = 404;
7+
}
8+
}

Diff for: dockerfile

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
##### Stage 1
2+
3+
FROM node:10.15.0 as builder
4+
5+
WORKDIR /app
6+
7+
# Copy project files to the docker image
8+
COPY . .
9+
10+
# install angular/cli globally (latest version, change this to the version you are using)
11+
RUN yarn global add @angular/cli@latest
12+
13+
# if you prefer npm, replace the above command with
14+
# RUN npm install @angular/cli@latest -g
15+
16+
# install packages
17+
# RUN yarn add
18+
RUN yarn install
19+
20+
#for npm
21+
# npm install
22+
23+
# SET ENVIRONMENT VARIABLES
24+
ENV environment=production
25+
26+
# Build Angular Application in Production
27+
RUN ng build --prod
28+
29+
#### STAGE 2
30+
#### Deploying the application
31+
32+
FROM nginx:alpine
33+
34+
VOLUME /var/cache/nginx
35+
36+
# Copy the build files from the project
37+
COPY --from=builder /app/dist/angular-docker-environment-variables /usr/share/nginx/html
38+
39+
# Copy Nginx Files
40+
COPY --from=builder /app/.docker/.config/nginx.conf /etc/nginx/conf.d/default.conf
41+
42+
# EXPOSE Port 80
43+
EXPOSE 80

0 commit comments

Comments
 (0)