From 2de31890bafbf3864e5f999e2a584cd7037681d9 Mon Sep 17 00:00:00 2001 From: Andrew Schlackman <72105194+sei-aschlackman@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:36:20 -0500 Subject: [PATCH] dockerfile and build fixes --- .github/workflows/main.yml | 8 ++++---- Dockerfile | 9 ++++----- angular.json | 3 +-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0cdee11..da616a9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Prepare id: prep @@ -50,17 +50,17 @@ jobs: echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub if: github.event_name != 'pull_request' - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile diff --git a/Dockerfile b/Dockerfile index 427d598..d4f94ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,11 @@ -FROM node:16-alpine as builder +FROM node:20-alpine as builder COPY package.json package-lock.json ./ # Storing node modules on a separate layer will prevent unnecessary npm install at each build RUN npm set progress=false && \ npm config set depth 0 && \ - npm cache clean --force && \ - npm config set unsafe-perm true + npm cache clean --force RUN npm ci && mkdir -p /ng-app/dist && cp -R ./node_modules ./ng-app @@ -14,7 +13,7 @@ WORKDIR /ng-app COPY . . -RUN $(npm bin)/ng build --resources-output-path=assets/fonts --configuration production +RUN npx ng build ### Stage 2: Setup ### @@ -25,7 +24,7 @@ RUN rm -rf /usr/share/nginx/html/* COPY default.conf /etc/nginx/conf.d/default.conf COPY scripts/nginx-basehref.sh /docker-entrypoint.d/90-basehref.sh COPY scripts/settings-from-env.sh /docker-entrypoint.d/91-settings-from-env.sh -COPY --from=builder /ng-app/dist /usr/share/nginx/html +COPY --from=builder /ng-app/dist/browser /usr/share/nginx/html RUN chown -R nginx:nginx /usr/share/nginx/html && chmod +x /docker-entrypoint.d/90-basehref.sh && chmod +x /docker-entrypoint.d/91-settings-from-env.sh USER nginx diff --git a/angular.json b/angular.json index 57f1f42..ed983c7 100644 --- a/angular.json +++ b/angular.json @@ -13,8 +13,7 @@ "options": { "preserveSymlinks": true, "outputPath": { - "base": "dist", - "browser": "" + "base": "dist" }, "index": "src/index.html", "tsConfig": "src/tsconfig.app.json",