From 1edbe7f6c363bdbfc4f20d3ef1d30cc7c8b57a85 Mon Sep 17 00:00:00 2001 From: An Pham Date: Sat, 11 May 2024 00:42:30 -0700 Subject: [PATCH] add kanico and badges --- README.md | 4 ++++ kanico/data/Dockerfile | 27 +++++++++++++++++++++++++++ kanico/data/requirements.txt | 4 ++++ kanico/pod.yml | 28 ++++++++++++++++++++++++++++ kanico/volume-claim.yaml | 13 +++++++++++++ kanico/volume.yaml | 14 ++++++++++++++ 6 files changed, 90 insertions(+) create mode 100644 README.md create mode 100644 kanico/data/Dockerfile create mode 100644 kanico/data/requirements.txt create mode 100644 kanico/pod.yml create mode 100644 kanico/volume-claim.yaml create mode 100644 kanico/volume.yaml diff --git a/README.md b/README.md new file mode 100644 index 0000000..eefbe4a --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +![Docker Pulls](https://img.shields.io/docker/pulls/phamduchongan93/virtualporfolio) + +# Overview +- Virtual Bussiness Card. diff --git a/kanico/data/Dockerfile b/kanico/data/Dockerfile new file mode 100644 index 0000000..2f66861 --- /dev/null +++ b/kanico/data/Dockerfile @@ -0,0 +1,27 @@ +# Use the official Python image as base +FROM python:3.9-slim + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# Set the working directory in the container +WORKDIR /app + +# Copy the requirements file into the container +COPY requirements.txt . + +# Install dependencies +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the entire application into the container +COPY . . + +# Create a volume for static files +VOLUME /app/static + +# Expose the port the app runs on +EXPOSE 5000 + +# Command to run the application +CMD python3 app.py diff --git a/kanico/data/requirements.txt b/kanico/data/requirements.txt new file mode 100644 index 0000000..1aef5c7 --- /dev/null +++ b/kanico/data/requirements.txt @@ -0,0 +1,4 @@ +Flask==2.0.1 +qrcode==7.3 +Pillow==8.3.1 +Werkzeug==2.0.1 diff --git a/kanico/pod.yml b/kanico/pod.yml new file mode 100644 index 0000000..822c1a2 --- /dev/null +++ b/kanico/pod.yml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Pod +metadata: + name: virtualcard +spec: + containers: + - name: kaniko + image: gcr.io/kaniko-project/executor:latest + args: [ + "--dockerfile=./Dockerfile", + "--context=dir:///workspace/", + "--destination=phamduchongan93/virtualporfolio"] # replace with your dockerhub account + volumeMounts: + - name: kaniko-secret + mountPath: /kaniko/.docker + - name: dockerfile-storage + mountPath: /workspace + restartPolicy: Never + volumes: + - name: kaniko-secret + secret: + secretName: regcred + items: + - key: .dockerconfigjson + path: config.json + - name: dockerfile-storage + persistentVolumeClaim: + claimName: dockerfile-virtualporfolio-claim diff --git a/kanico/volume-claim.yaml b/kanico/volume-claim.yaml new file mode 100644 index 0000000..a3cd873 --- /dev/null +++ b/kanico/volume-claim.yaml @@ -0,0 +1,13 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: dockerfile-virtualporfolio-claim +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 4Gi + storageClassName: manual + volumeMode: Filesystem + volumeName: virtual-porfolio-pv diff --git a/kanico/volume.yaml b/kanico/volume.yaml new file mode 100644 index 0000000..845daf7 --- /dev/null +++ b/kanico/volume.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: virtual-porfolio-pv + labels: + type: local +spec: + capacity: + storage: 15Gi + accessModes: + - ReadWriteOnce + storageClassName: manual + hostPath: + path: /home/ubuntu/virtualporfolio/kanico/data # replace with local directory, such as "/home//kaniko"