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 }}
cache-from: type=gha
cache-to: type=gha,mode=max
# deploy:
# runs-on: ubuntu-latest
# name: Deploy to flux
# needs: build
# steps:
# - name: Check out Kubernetes repo
# uses: actions/checkout@v3
# with:
# repository: rmitchellscott/kubernetes-apps
# token: ${{ secrets.PAT }}
# - id: short-sha
# uses: benjlevesque/short-sha@v1.2
# - name: Replace the image tag
# env:
# TAG: ${{ steps.short-sha.outputs.sha }}
# run: yq -i e '(select(.kind=="Deployment" and .metadata.name==env(DEPLOYMENT)) | .spec.template.spec.containers.[].image) |= split(":").0 + ":" + env(TAG)' $YAMLPATH
# - name: Commit and push
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: Update image tag for ${{env.DEPLOYMENT}} to ${{ steps.short-sha.outputs.sha }}
deploy:
runs-on: ubuntu-latest
name: Deploy to flux
needs: build
steps:
- name: Check out Kubernetes repo
uses: actions/checkout@v3
with:
repository: rmitchellscott/kubernetes-apps
token: ${{ secrets.PAT }}
ref: "master"
- id: short-sha
uses: benjlevesque/short-sha@v1.2
- name: Replace the image tag
env:
TAG: ${{ steps.short-sha.outputs.sha }}
run: yq -i e '(select(.kind=="Deployment" and .metadata.name==env(DEPLOYMENT)) | .spec.template.spec.containers.[].image) |= split(":").0 + ":" + env(TAG)' $YAMLPATH
- name: Commit and push
uses: stefanzweifel/git-auto-commit-action@v4
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
WORKDIR /app
COPY package*.json .
RUN npm ci
COPY . .
RUN npm install
CMD ["node", "index.js"]