forked from Cuuhomientrung/cuuhomientrung
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cuuhomientrung#242: Added simple build scripts and k8s config
- Loading branch information
1 parent
c927b76
commit 4b06bde
Showing
5 changed files
with
550 additions
and
9 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM python:3 | ||
WORKDIR /code | ||
|
||
# ENV should be configure from outside | ||
# Below are default environment to show sample how to use the image. | ||
# @see docker-compose.yaml | ||
ENV DB_NAME cuuhomientrung | ||
ENV DB_USER cuuhomientrung | ||
ENV DB_PASSWORD cuuhomientrung | ||
ENV DB_HOSTNAME localhost | ||
ENV DB_PORT 5432 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Node and webpack | ||
RUN apt-get update -qq && \ | ||
apt-get install -y --no-install-recommends vim curl gnupg && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - | ||
RUN apt-get install -y --no-install-recommends nodejs && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
#Download and cache dependencies | ||
ADD requirements ./requirements | ||
ADD package.json ./ | ||
ADD package-lock.json ./ | ||
RUN pip install -r ./requirements/development.txt --no-cache-dir &&\ | ||
pip install -r ./requirements/testing.txt --no-cache-dir &&\ | ||
npm install | ||
|
||
#Add code | ||
ADD . ./ | ||
RUN npm run build | ||
|
||
#Prepare runtime | ||
RUN chmod +x *.sh | ||
ENTRYPOINT ./run_server.sh | ||
EXPOSE 8087/tcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
set -e | ||
BUILD_NUMBER=${BUILD_NUMBER:=dev} | ||
VERSION=0.0.1 | ||
IMAGE_TAG=$VERSION-$BUILD_NUMBER | ||
cd ../ | ||
sudo docker build -f deployment/Dockerfile -t cuuhomientrung/server:$IMAGE_TAG . | ||
sudo docker push cuuhomientrung/server:$IMAGE_TAG | ||
sudo docker tag cuuhomientrung/server:$IMAGE_TAG cuuhomientrung/server:latest | ||
sudo docker push cuuhomientrung/server:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
annotations: | ||
field.cattle.io/creatorId: user-89ghq | ||
field.cattle.io/publicEndpoints: '[{"port":32082,"protocol":"TCP","serviceName":"cuuhomientrung-staging:postgres-nodeport","allNodes":true}]' | ||
creationTimestamp: "2021-06-01T14:12:51Z" | ||
generation: 7 | ||
labels: | ||
cattle.io/creator: norman | ||
workload.user.cattle.io/workloadselector: statefulSet-cuuhomientrung-staging-postgres | ||
managedFields: | ||
- apiVersion: apps/v1 | ||
fieldsType: FieldsV1 | ||
fieldsV1: | ||
f:metadata: | ||
f:annotations: | ||
.: {} | ||
f:field.cattle.io/creatorId: {} | ||
f:labels: | ||
.: {} | ||
f:cattle.io/creator: {} | ||
f:workload.user.cattle.io/workloadselector: {} | ||
f:spec: | ||
f:podManagementPolicy: {} | ||
f:replicas: {} | ||
f:revisionHistoryLimit: {} | ||
f:selector: {} | ||
f:serviceName: {} | ||
f:template: | ||
f:metadata: | ||
f:annotations: | ||
.: {} | ||
f:cattle.io/timestamp: {} | ||
f:field.cattle.io/ports: {} | ||
f:labels: | ||
.: {} | ||
f:workload.user.cattle.io/workloadselector: {} | ||
f:spec: | ||
f:containers: | ||
k:{"name":"postgres"}: | ||
.: {} | ||
f:env: | ||
.: {} | ||
k:{"name":"POSTGRES_DB"}: | ||
.: {} | ||
f:name: {} | ||
f:value: {} | ||
k:{"name":"POSTGRES_PASSWORD"}: | ||
.: {} | ||
f:name: {} | ||
f:valueFrom: | ||
.: {} | ||
f:secretKeyRef: | ||
.: {} | ||
f:key: {} | ||
f:name: {} | ||
f:optional: {} | ||
k:{"name":"POSTGRES_USER"}: | ||
.: {} | ||
f:name: {} | ||
f:value: {} | ||
f:image: {} | ||
f:imagePullPolicy: {} | ||
f:name: {} | ||
f:ports: | ||
.: {} | ||
k:{"containerPort":5432,"protocol":"TCP"}: | ||
.: {} | ||
f:containerPort: {} | ||
f:name: {} | ||
f:protocol: {} | ||
f:resources: {} | ||
f:securityContext: | ||
.: {} | ||
f:allowPrivilegeEscalation: {} | ||
f:capabilities: {} | ||
f:privileged: {} | ||
f:readOnlyRootFilesystem: {} | ||
f:runAsNonRoot: {} | ||
f:stdin: {} | ||
f:terminationMessagePath: {} | ||
f:terminationMessagePolicy: {} | ||
f:tty: {} | ||
f:volumeMounts: | ||
.: {} | ||
k:{"mountPath":"/var/lib/postgresql/data"}: | ||
.: {} | ||
f:mountPath: {} | ||
f:name: {} | ||
f:subPath: {} | ||
f:dnsPolicy: {} | ||
f:restartPolicy: {} | ||
f:schedulerName: {} | ||
f:securityContext: {} | ||
f:terminationGracePeriodSeconds: {} | ||
f:volumes: | ||
.: {} | ||
k:{"name":"data"}: | ||
.: {} | ||
f:name: {} | ||
f:persistentVolumeClaim: | ||
.: {} | ||
f:claimName: {} | ||
f:updateStrategy: | ||
f:rollingUpdate: | ||
.: {} | ||
f:partition: {} | ||
f:type: {} | ||
manager: Go-http-client | ||
operation: Update | ||
time: "2021-06-01T14:22:03Z" | ||
- apiVersion: apps/v1 | ||
fieldsType: FieldsV1 | ||
fieldsV1: | ||
f:metadata: | ||
f:annotations: | ||
f:field.cattle.io/publicEndpoints: {} | ||
manager: rancher | ||
operation: Update | ||
time: "2021-06-01T14:45:43Z" | ||
- apiVersion: apps/v1 | ||
fieldsType: FieldsV1 | ||
fieldsV1: | ||
f:status: | ||
f:collisionCount: {} | ||
f:currentReplicas: {} | ||
f:currentRevision: {} | ||
f:observedGeneration: {} | ||
f:readyReplicas: {} | ||
f:replicas: {} | ||
f:updateRevision: {} | ||
f:updatedReplicas: {} | ||
manager: k3s | ||
operation: Update | ||
time: "2021-06-01T14:46:12Z" | ||
name: postgres | ||
spec: | ||
podManagementPolicy: OrderedReady | ||
replicas: 1 | ||
revisionHistoryLimit: 10 | ||
selector: | ||
matchLabels: | ||
workload.user.cattle.io/workloadselector: statefulSet-cuuhomientrung-staging-postgres | ||
serviceName: postgres | ||
template: | ||
metadata: | ||
annotations: | ||
cattle.io/timestamp: "2021-06-01T14:45:42Z" | ||
field.cattle.io/ports: '[[{"containerPort":5432,"dnsName":"postgres-nodeport","hostPort":0,"kind":"NodePort","name":"5432tcp1","protocol":"TCP"}]]' | ||
creationTimestamp: null | ||
labels: | ||
workload.user.cattle.io/workloadselector: statefulSet-cuuhomientrung-staging-postgres | ||
spec: | ||
containers: | ||
- env: | ||
- name: POSTGRES_DB | ||
value: cuuhomientrung | ||
- name: POSTGRES_USER | ||
value: cuuhomientrung | ||
- name: POSTGRES_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
key: DB_PASSWORD | ||
name: cuuhomientrung | ||
optional: false | ||
image: postgres | ||
imagePullPolicy: Always | ||
name: postgres | ||
ports: | ||
- containerPort: 5432 | ||
name: 5432tcp1 | ||
protocol: TCP | ||
resources: {} | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
capabilities: {} | ||
privileged: false | ||
readOnlyRootFilesystem: false | ||
runAsNonRoot: false | ||
stdin: true | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
tty: true | ||
volumeMounts: | ||
- mountPath: /var/lib/postgresql/data | ||
name: data | ||
subPath: postgresql | ||
dnsPolicy: ClusterFirst | ||
restartPolicy: Always | ||
schedulerName: default-scheduler | ||
securityContext: {} | ||
terminationGracePeriodSeconds: 30 | ||
volumes: | ||
- name: data | ||
persistentVolumeClaim: | ||
claimName: cuuhomientrung-staging-postgres | ||
updateStrategy: | ||
rollingUpdate: | ||
partition: 0 | ||
type: RollingUpdate | ||
status: | ||
collisionCount: 0 | ||
currentReplicas: 1 | ||
currentRevision: postgres-c466fd5f6 | ||
observedGeneration: 7 | ||
readyReplicas: 1 | ||
replicas: 1 | ||
updateRevision: postgres-c466fd5f6 | ||
updatedReplicas: 1 |
Oops, something went wrong.