Tweak Dockerfile for better caching

This commit is contained in:
Mitchell Scott 2023-04-13 15:38:30 -06:00
parent e1083c83ae
commit 146a3fda76
2 changed files with 26 additions and 21 deletions

View file

@ -46,23 +46,24 @@ jobs:
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
# deploy: deploy:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# name: Deploy to flux name: Deploy to flux
# needs: build needs: build
# steps: steps:
# - name: Check out Kubernetes repo - name: Check out Kubernetes repo
# uses: actions/checkout@v3 uses: actions/checkout@v3
# with: with:
# repository: rmitchellscott/kubernetes-apps repository: rmitchellscott/kubernetes-apps
# token: ${{ secrets.PAT }} token: ${{ secrets.PAT }}
# - id: short-sha ref: "master"
# uses: benjlevesque/short-sha@v1.2 - id: short-sha
# - name: Replace the image tag uses: benjlevesque/short-sha@v1.2
# env: - name: Replace the image tag
# TAG: ${{ steps.short-sha.outputs.sha }} env:
# run: yq -i e '(select(.kind=="Deployment" and .metadata.name==env(DEPLOYMENT)) | .spec.template.spec.containers.[].image) |= split(":").0 + ":" + env(TAG)' $YAMLPATH TAG: ${{ steps.short-sha.outputs.sha }}
# - name: Commit and push run: yq -i e '(select(.kind=="Deployment" and .metadata.name==env(DEPLOYMENT)) | .spec.template.spec.containers.[].image) |= split(":").0 + ":" + env(TAG)' $YAMLPATH
# uses: stefanzweifel/git-auto-commit-action@v4 - name: Commit and push
# with: uses: stefanzweifel/git-auto-commit-action@v4
# commit_message: Update image tag for ${{env.DEPLOYMENT}} to ${{ steps.short-sha.outputs.sha }} with:
commit_message: Update image tag for ${{env.DEPLOYMENT}} to ${{ steps.short-sha.outputs.sha }}

View file

@ -1,4 +1,8 @@
FROM node:18-alpine FROM node:18-alpine
WORKDIR /app
COPY package*.json .
RUN npm ci
COPY . . COPY . .
RUN npm install
CMD ["node", "index.js"] CMD ["node", "index.js"]