Add dockerfile and build

This commit is contained in:
Mitchell Scott 2023-04-13 11:43:52 -06:00
parent 249cbb93e6
commit e1083c83ae
5 changed files with 75 additions and 0 deletions

3
.dockerignore Normal file
View file

@ -0,0 +1,3 @@
.git/
Dockerfile
.vscode/

68
.github/workflows/build-deploy.yaml vendored Normal file
View file

@ -0,0 +1,68 @@
name: cd
on: push
env:
DEPLOYMENT: weatherstar
YAMLPATH: clusters/home-kluster/apps/weatherstar/weatherstar/app/deployment.yaml
jobs:
build:
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: short-sha
uses: benjlevesque/short-sha@v1.2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/rmitchellscott/ws4kp
tags: |
type=raw,priority=1000,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
${{ steps.short-sha.outputs.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
pull: true
push: ${{ github.ref == 'refs/heads/main' }}
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
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 }}

4
Dockerfile Normal file
View file

@ -0,0 +1,4 @@
FROM node:18-alpine
COPY . .
RUN npm install
CMD ["node", "index.js"]

BIN
server/images/Logo3-OG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB