Skip to content

Commit 2908cba

Browse files
authored
Merge pull request #328 from cmu-sei/fix-entry-scripts
fix entry scripts
2 parents b0664c0 + cec520b commit 2908cba

File tree

13 files changed

+19613
-138
lines changed

13 files changed

+19613
-138
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @sei-ebram @sei-tspencer @sei-chershberger @sei-aschlackman @sei-noconnor
1+
* @sei-tspencer @sei-chershberger @sei-aschlackman @sei-noconnor

angular.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"build": {
1414
"builder": "@angular-devkit/build-angular:browser",
1515
"options": {
16-
"outputPath": "dist/steamfitter-web",
16+
"outputPath": "dist",
1717
"index": "src/index.html",
1818
"main": "src/main.ts",
1919
"polyfills": "src/polyfills.ts",

build-container.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

docker-compose.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

dockerfile

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
1-
FROM node as builder
1+
FROM node:16-alpine as builder
22

33
COPY package.json package-lock.json ./
44

5-
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
6-
RUN npm set progress=false && \
7-
npm config set depth 0 && \
8-
npm cache clean --force && \
9-
npm config set unsafe-perm true
10-
11-
RUN npm ci && mkdir -p /ng-app/dist/steamfitter-web && cp -R ./node_modules ./ng-app
5+
# Storing node modules on a separate layer will prevent unnecessary npm install at each build
6+
RUN npm i && mkdir -p /ng-app/dist && cp -R ./node_modules ./ng-app
127

138
WORKDIR /ng-app
149

1510
COPY . .
1611

17-
## Build the angular app in production mode and store the artifacts in dist folder
18-
RUN $(npm bin)/ng build --configuration production
12+
RUN $(npm bin)/ng build --resources-output-path=assets/fonts --aot --configuration production
1913

2014
### Stage 2: Setup ###
2115

2216
FROM nginxinc/nginx-unprivileged:stable-alpine
2317

2418
USER root
2519
RUN rm -rf /usr/share/nginx/html/*
26-
USER nginx
27-
2820
COPY default.conf /etc/nginx/conf.d/default.conf
2921
COPY nginx-basehref.sh /docker-entrypoint.d/90-basehref.sh
30-
COPY --from=builder ./ng-app/dist/steamfitter-web /usr/share/nginx/html
22+
COPY --from=builder /ng-app/dist /usr/share/nginx/html
23+
RUN chown -R nginx:nginx /usr/share/nginx/html && \
24+
chmod +x /docker-entrypoint.d/90-basehref.sh
25+
USER nginx
3126

3227
EXPOSE 8080
3328

34-
ENTRYPOINT ["nginx", "-g", "daemon off;"]
29+
ENTRYPOINT ["/docker-entrypoint.sh"]
30+
CMD ["nginx", "-g", "daemon off;"]

nginx-basehref.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/sh
22
set -e
3-
src=/var/www
3+
4+
src=/usr/share/nginx/html
45
basehref=`echo $APP_BASEHREF | sed -e s,^/,, -e s,/$,,`
56
if [ -n "$basehref" ]; then
67
sed -i "s,base\ href=\"/\",base\ href=\"/$basehref/\"," $src/index.html

0 commit comments

Comments
 (0)