Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
243 commits
Select commit Hold shift + click to select a range
4a72e8b
python project complated
beny1221g May 8, 2024
1ce957d
jenkins
beny1221g May 29, 2024
6ff6592
jenkins2
beny1221g May 29, 2024
136c8ea
jenkins12
beny1221g May 29, 2024
74fb182
jenkins1122
beny1221g May 29, 2024
ef4e989
jenkins1111212
beny1221g May 29, 2024
9b59e57
jenk
beny1221g May 29, 2024
ef8a735
jenk1
beny1221g May 29, 2024
3dbc758
jenk211
beny1221g May 29, 2024
8a45a1c
build_dockerfile
beny1221g Jun 5, 2024
7f4cf48
change file
beny1221g Jun 5, 2024
8312f44
change file2
beny1221g Jun 5, 2024
28ebfa7
change files
beny1221g Jun 5, 2024
374169d
hh
beny1221g Jun 5, 2024
5b1b24b
hh2
beny1221g Jun 5, 2024
90dffb3
hh2
beny1221g Jun 5, 2024
c37ff86
hh2
beny1221g Jun 5, 2024
b0622aa
hh2
beny1221g Jun 5, 2024
912edfc
hh2
beny1221g Jun 5, 2024
831e21b
hh2
beny1221g Jun 5, 2024
ed21a1d
hh2
beny1221g Jun 5, 2024
5ae9e5e
hh2
beny1221g Jun 5, 2024
3370b28
hh2
beny1221g Jun 5, 2024
09cb389
hh2
beny1221g Jun 5, 2024
75d4919
hh2
beny1221g Jun 5, 2024
2688e3d
hh2
beny1221g Jun 5, 2024
38fc234
hh2
beny1221g Jun 5, 2024
706178e
hh2
beny1221g Jun 5, 2024
bef053f
hh2
beny1221g Jun 5, 2024
90fa441
hh2
beny1221g Jun 5, 2024
a83f9fe
hh2
beny1221g Jun 5, 2024
6c47977
hh2
beny1221g Jun 5, 2024
6eba209
hh2
beny1221g Jun 5, 2024
0df2894
hh2
beny1221g Jun 5, 2024
eee677f
hh2
beny1221g Jun 5, 2024
2ac64b0
hh2
beny1221g Jun 5, 2024
7f89815
hh2
beny1221g Jun 5, 2024
3cdc845
hh2
beny1221g Jun 5, 2024
6a3943c
hh2
beny1221g Jun 5, 2024
6d8fc2b
hh2
beny1221g Jun 5, 2024
e711530
hh2
beny1221g Jun 9, 2024
c3cda0d
hh2
beny1221g Jun 9, 2024
0efe3d4
hh2
beny1221g Jun 9, 2024
1b7a677
hh2
beny1221g Jun 9, 2024
fd17604
hh2
beny1221g Jun 9, 2024
df8dcc8
hh2
beny1221g Jun 9, 2024
03964a6
hh2
beny1221g Jun 9, 2024
318de63
try changes
beny1221g Jun 9, 2024
e62e519
try changes
beny1221g Jun 9, 2024
be51e57
try changes
beny1221g Jun 9, 2024
c85ce78
try changes
beny1221g Jun 9, 2024
5df136a
try changes
beny1221g Jun 9, 2024
e56b4a2
try changes
beny1221g Jun 9, 2024
13f65f6
try changes
beny1221g Jun 9, 2024
3ba1c5e
try changes
beny1221g Jun 9, 2024
8cbf08b
try changes
beny1221g Jun 9, 2024
32419d8
try changes
beny1221g Jun 9, 2024
fccc076
try changes
beny1221g Jun 9, 2024
670e797
try changes
beny1221g Jun 9, 2024
8eb7e51
try changes
beny1221g Jun 9, 2024
e84b422
try changes
beny1221g Jun 9, 2024
397d3a3
try changes
beny1221g Jun 9, 2024
009cec6
try changes
beny1221g Jun 9, 2024
ed707dd
try changes
beny1221g Jun 9, 2024
a1e6fcc
try changes
beny1221g Jun 9, 2024
c5b0997
try changes
beny1221g Jun 9, 2024
853ec1c
try changes
beny1221g Jun 9, 2024
44ca059
try changes
beny1221g Jun 9, 2024
2521777
try changes
beny1221g Jun 9, 2024
7fcebd9
Update build.Jenkinsfile to work with ubuntu
beny1221g Jun 12, 2024
1735abe
Update build.Jenkinsfile ubuntu
beny1221g Jun 12, 2024
e3dcece
Update deploy.Jenkinsfile ubuntu update
beny1221g Jun 12, 2024
2cf2b95
update dirwork
beny1221g Jun 13, 2024
4538163
Merge https://github.com/beny1221g/ImageProcessingService
beny1221g Jun 13, 2024
51f20fd
update work dir to app
beny1221g Jun 13, 2024
8808440
as
beny1221g Jun 13, 2024
90333be
sa
beny1221g Jun 13, 2024
0d8f71a
sa
beny1221g Jun 13, 2024
87db54a
as
beny1221g Jun 13, 2024
eb6427f
sa
beny1221g Jun 15, 2024
50dd9bf
add pr-testing.jenkisfile
beny1221g Jun 16, 2024
e0dc90d
add pr-testing.jenkisfile
beny1221g Jun 16, 2024
4fbb219
add to req
beny1221g Jun 16, 2024
4b19809
docker file for agent added
beny1221g Jun 19, 2024
95c51dd
docker file for agent added
beny1221g Jun 19, 2024
cb313fe
update
beny1221g Jun 19, 2024
ba0b5b5
update
beny1221g Jun 19, 2024
74587a1
update 20/06/24
beny1221g Jun 20, 2024
f919683
update 20/06/24
beny1221g Jun 20, 2024
08af6b5
update 20/06/24
beny1221g Jun 20, 2024
a0f1dfd
update 20/06/24
beny1221g Jun 20, 2024
8694842
update 20/06/24
beny1221g Jun 20, 2024
5793efc
update 20/06/24
beny1221g Jun 20, 2024
5c2f512
update 20/06/24
beny1221g Jun 20, 2024
a366a3d
add nginx and docker compose file
beny1221g Jun 23, 2024
8324003
update nginx and docker compose file
beny1221g Jun 23, 2024
5dca144
update nginx and docker compose file
beny1221g Jun 23, 2024
a3efac0
Update requirements.txt
beny1221g Jun 23, 2024
b6166e6
update
beny1221g Jun 26, 2024
08c0e32
Merge remote-tracking branch 'origin/main'
beny1221g Jun 26, 2024
b8e7869
update build.Jenkinsfile with step 6
beny1221g Jun 29, 2024
a393b9c
update build.Jenkinsfile with step 6
beny1221g Jun 29, 2024
fe87efe
update build.Jenkinsfile with step 6
beny1221g Jun 29, 2024
d525c94
update build.Jenkinsfile with step 6
beny1221g Jun 29, 2024
19e3da0
update build.Jenkinsfile with step 6
beny1221g Jun 29, 2024
5b99b17
update build.Jenkinsfile with step 6
beny1221g Jun 29, 2024
e316de1
update build.Jenkinsfile with step 6
beny1221g Jun 29, 2024
b7312fb
update build.Jenkinsfile with step 6
beny1221g Jun 29, 2024
3f07782
update build.Jenkinsfile with step 6
beny1221g Jun 29, 2024
d6a1c43
update build.Jenkinsfile with step 6
beny1221g Jun 29, 2024
4842a17
update build.Jenkinsfile with step 6
beny1221g Jun 30, 2024
43b614e
update build.Jenkinsfile with step 6
beny1221g Jun 30, 2024
5db1357
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
8c282b2
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
68bcbfe
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
f101ed7
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
4c3a313
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
0dc19cd
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
ff5056f
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
c3d1f6d
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
d229cac
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
157566f
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
afc141f
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
b725f4c
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
8b3f4e7
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
245d738
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
df78642
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
2a515ea
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 1, 2024
31d2b6f
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 3, 2024
d533249
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 3, 2024
69943ad
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 3, 2024
c160784
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 3, 2024
c7780d3
update build.Jenkinsfile with step 6 , 2
beny1221g Jul 3, 2024
4c9ff80
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
3d358b7
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
ed8414f
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
8e93ef9
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
ef3e98b
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
c7d5ad3
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
7d69e46
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
3d67e0d
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
d52b5a0
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
a8ce31c
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
63b67ab
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
1796655
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
827ebce
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
54e6605
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
12fc7b6
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
e1b0e91
update build.Jenkinsfile add snyk
beny1221g Jul 4, 2024
239f127
update build.Jenkinsfile add back to last SUCCESS and add snyk
beny1221g Jul 5, 2024
3d575b8
update build.Jenkinsfile add back to last SUCCESS and add snyk
beny1221g Jul 5, 2024
7425791
update build.Jenkinsfile update work with snyk
beny1221g Jul 5, 2024
99d7800
update build.Jenkinsfile update work with snyk
beny1221g Jul 5, 2024
f2d85c6
update build.Jenkinsfile update work with snyk
beny1221g Jul 5, 2024
c7b3d95
update build.Jenkinsfile update work with snyk
beny1221g Jul 5, 2024
e4097dd
update build.Jenkinsfile update work with snyk
beny1221g Jul 5, 2024
56a3086
update build.Jenkinsfile update work with snyk
beny1221g Jul 5, 2024
55bffe1
update build.Jenkinsfile update work with snyk
beny1221g Jul 7, 2024
03ec8c3
update build.Jenkinsfile update work with snyk
beny1221g Jul 7, 2024
7ccae48
update build.Jenkinsfile update work with snyk
beny1221g Jul 7, 2024
e3617ba
update build.Jenkinsfile update work with snyk
beny1221g Jul 9, 2024
90904f1
update build.Jenkinsfile update work with snyk
beny1221g Jul 9, 2024
ffc4648
update build.Jenkinsfile update work with snyk
beny1221g Jul 9, 2024
ccc1922
update build.Jenkinsfile update work with snyk
beny1221g Jul 9, 2024
ea38d4d
update build.Jenkinsfile update work with snyk
beny1221g Jul 10, 2024
09eae5e
update build.Jenkinsfile update work with snyk
beny1221g Jul 10, 2024
453cb04
update build.Jenkinsfile update work with snyk
beny1221g Jul 10, 2024
60ba55f
update build.Jenkinsfile update work with snyk
beny1221g Jul 10, 2024
84fda65
update build.Jenkinsfile update work with snyk
beny1221g Jul 10, 2024
0f05c73
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 10, 2024
e720872
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 10, 2024
b1240c7
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 10, 2024
99ba57e
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 10, 2024
14d12b9
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 10, 2024
3308109
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 10, 2024
590469f
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 13, 2024
ae49023
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 13, 2024
31f74d6
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 13, 2024
27dd25c
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 13, 2024
ac898d0
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 13, 2024
a62de37
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 13, 2024
a35bce0
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 13, 2024
703a467
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 13, 2024
9605b48
update build.Jenkinsfile update work with unitest and token in .env
beny1221g Jul 13, 2024
51a15f6
update build.Jenkinsfile update to work with nexus
beny1221g Jul 13, 2024
857f6ac
update build.Jenkinsfile update to work with nexus
beny1221g Jul 13, 2024
1bf40cf
update build.Jenkinsfile update to work with nexus
beny1221g Jul 13, 2024
1d8c72b
update build.Jenkinsfile update to work with nexus
beny1221g Jul 13, 2024
4a3d2f1
update build.Jenkinsfile update to work with nexus
beny1221g Jul 13, 2024
eff6509
update build.Jenkinsfile update to work with nexus
beny1221g Jul 13, 2024
ed936d2
update build.Jenkinsfile update
beny1221g Jul 13, 2024
6e5ace9
update build.Jenkinsfile update nexus
beny1221g Jul 15, 2024
db9ef46
update build.Jenkinsfile update nexus
beny1221g Jul 15, 2024
87b9a37
update build.Jenkinsfile update nexus
beny1221g Jul 15, 2024
e8bc0cf
update build.Jenkinsfile update nexus
beny1221g Jul 15, 2024
5b0ef37
update build.Jenkinsfile update nexus
beny1221g Jul 15, 2024
c0d48dc
update build.Jenkinsfile update nexus
beny1221g Jul 15, 2024
5c3d0bf
update build.Jenkinsfile update nexus
beny1221g Jul 15, 2024
9b5ec0c
update build.Jenkinsfile update nexus
beny1221g Jul 15, 2024
e28c9d5
update build.Jenkinsfile update nexus
beny1221g Jul 15, 2024
332c1bd
update build.Jenkinsfile update nexus
beny1221g Jul 15, 2024
c303c33
update build.Jenkinsfile update nexus
beny1221g Jul 16, 2024
623e3b3
update build.Jenkinsfile update nexus
beny1221g Jul 16, 2024
c669da6
update build.Jenkinsfile update nexus
beny1221g Jul 16, 2024
9a680d5
update build.Jenkinsfile update nexus
beny1221g Jul 17, 2024
4bc63db
update build.Jenkinsfile update nexus
beny1221g Jul 17, 2024
98ad495
update build.Jenkinsfile update nexus
beny1221g Jul 17, 2024
451df81
update build.Jenkinsfile update nexus
beny1221g Jul 17, 2024
763b82e
update build.Jenkinsfile update nexus
beny1221g Jul 17, 2024
ac6afd7
update build.Jenkinsfile update nexus
beny1221g Jul 17, 2024
520c8d4
update build.Jenkinsfile update nexus
beny1221g Jul 17, 2024
d4be1dc
update build.Jenkinsfile update nexus
beny1221g Jul 17, 2024
16f454b
update build.Jenkinsfile update nexus
beny1221g Jul 17, 2024
c782790
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
aa669ea
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
1a9d115
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
a19ea4b
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
088334d
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
9163e2e
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
de092d2
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
56ca24c
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
1af8051
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
4dbfe88
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
62853e7
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
7030c3c
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
e195993
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
5d335cb
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
24b3def
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
6be8123
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
719ea1b
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
2b793c4
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
d6efd27
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
ae51a4c
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
41f83dd
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
29df989
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
5d232d9
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
31fa33d
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
c2e27a8
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
98ce3b0
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
57364c4
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
02f75db
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
27bc8c9
update build.Jenkinsfile add share-lib
beny1221g Jul 20, 2024
45cb957
update build.Jenkinsfile add share-lib
beny1221g Jul 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ __pycache__/

# Distribution / packaging
.Python
build/
bu
develop-eggs/
dist/
downloads/
Expand All @@ -25,7 +25,8 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST

jenkis_try
.env
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
Expand Down
10 changes: 10 additions & 0 deletions .snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: v1.15.0
ignore:
"SNYK-ID-EXAMPLE":
- "*":
reason: "Reason for ignoring this vulnerability"
expires: "2024-12-31T12:00:00Z"
"ANOTHER-SNYK-ID":
- "*":
reason: "Reason for ignoring this vulnerability"
expires: "2024-12-31T12:00:00Z"
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Use an official Python runtime as a parent image
FROM python:3.8-slim

# Set the working directory in the container
WORKDIR /app

# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 \
libgl1-mesa-glx \
curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install Snyk
RUN curl -Lo snyk https://github.com/snyk/snyk/releases/latest/download/snyk-linux \
&& chmod +x snyk \
&& mv snyk /usr/local/bin/

# Copy the requirements file and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
COPY . .

# Set the working directory to the polybot directory
WORKDIR /app/polybot

# Expose port 5000
EXPOSE 5000

# Run the bot when the container launches
CMD ["python3", "bot.py"]
26 changes: 26 additions & 0 deletions Dockerfile_agent
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM amazonlinux:2 as installer
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
RUN yum update -y \
&& yum install -y unzip \
&& unzip awscliv2.zip \
&& ./aws/install --bin-dir /aws-cli-bin/



RUN mkdir /snyk && cd /snyk \
&& curl https://static.snyk.io/cli/v1.666.0/snyk-linux -o snyk \
&& chmod +x ./snyk



#FROM jenkins/jnlp-agent-python .
FROM jenkins/agent
COPY --from=docker /usr/local/bin/docker /usr/local/bin/
COPY --from=installer /usr/local/aws-cli/ /usr/local/aws-cli/
COPY --from=installer /aws-cli-bin/ /usr/local/bin/
COPY --from=installer /snyk/ /usr/local/bin/
COPY --from=installer /snyk/ /usr/bin/
USER root
RUN apt-get update && apt-get install -y python3 python3-pip
USER jenkins

144 changes: 144 additions & 0 deletions build.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
@Library('shared-lib') _

pipeline {
options {
buildDiscarder(logRotator(daysToKeepStr: '14'))
disableConcurrentBuilds()
timestamps()
timeout(time: 40, unit: 'MINUTES') // Set a global timeout for the pipeline
}

environment {
IMG_NAME = "polybot:${BUILD_NUMBER}"
DOCKER_REPO = "beny14/polybot"
SNYK_TOKEN = credentials('SNYK_TOKEN')
TELEGRAM_TOKEN = credentials('TELEGRAM_TOKEN')
}

agent {
docker {
image 'beny14/dockerfile_agent:latest'
args '--user root -v /var/run/docker.sock:/var/run/docker.sock'
}
}

stages {
stage('Build') {
steps {
withCredentials([usernamePassword(credentialsId: 'dockerhub_key', usernameVariable: 'USERNAME', passwordVariable: 'USERPASS')]) {
script {
try {
echo "Starting Docker build"
sh """
echo ${USERPASS} | docker login -u ${USERNAME} --password-stdin
docker build -t ${DOCKER_REPO}:${BUILD_NUMBER} .
docker tag ${DOCKER_REPO}:${BUILD_NUMBER} ${DOCKER_REPO}:latest
docker push ${DOCKER_REPO}:${BUILD_NUMBER}
docker push ${DOCKER_REPO}:latest

"""

foo()//shared lib
echo "Docker build and push completed"
} catch (Exception e) {
error "Build failed: ${e.getMessage()}"
}
}
}
}
}

stage('Unit Test') {
steps {
script {
echo "Starting Unit Tests"
docker.image("${DOCKER_REPO}:${BUILD_NUMBER}").inside {
sh """
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
pip install pytest-xdist pytest-timeout
# Run pytest with verbosity and timeout for each test
python3 -m pytest -n 4 --timeout=60 --junitxml results.xml tests/*.py
deactivate
"""
}
echo "Unit Tests completed"
}
}
post {
always {
junit allowEmptyResults: true, testResults: 'results.xml'
echo "Unit Test log content:"
sh 'cat results.xml'
}
}
}

stage('Lint Test') {
steps {
script {
try {
echo "Starting Lint Tests"
docker.image("${DOCKER_REPO}:${BUILD_NUMBER}").inside {
sh '''
python3 -m venv venv
. venv/bin/activate
pylint --disable=E1136,C0301,C0114,E1101,C0116,C0103,W0718,E0401,W0613,R1722,W0612,R0912,C0304,C0115,R1705 polybot/*.py > pylint.log || true
ls -alh
cat pylint.log
deactivate
'''
}
echo "Lint Tests completed"
} catch (Exception e) {
error "Test failed: ${e.getMessage()}"
}
}
}
post {
always {
script {
try {
archiveArtifacts artifacts: 'pylint.log', allowEmptyArchive: true
echo "Pylint log content:"
sh 'cat pylint.log'
} catch (Exception e) {
echo "Archiving or recording issues failed: ${e.getMessage()}"
}
}
}
}
}
}

post {
always {
script {
echo "Cleaning up Docker containers and images"
def containerId = sh(script: "docker ps -q -f ancestor=${DOCKER_REPO}:${BUILD_NUMBER}", returnStdout: true).trim()

sh """
for id in \$(docker ps -a -q -f ancestor=${DOCKER_REPO}:${BUILD_NUMBER}); do
if [ "\$id" != "${containerId}" ]; then
docker rm -f \$id || true
fi
done
"""
sh """
docker images --format '{{.Repository}}:{{.Tag}} {{.ID}}' | grep '${DOCKER_REPO}' | grep -v ':latest' | grep -v ':${BUILD_NUMBER}' | awk '{print \$2}' | xargs --no-run-if-empty docker rmi -f || true
"""
cleanWs()
echo "Cleanup completed"
}
}

failure {
script {
def errorMessage = currentBuild.result == 'FAILURE' ? currentBuild.description : 'Build failed'
echo "Error occurred: ${errorMessage}"
}
}
}
}
36 changes: 36 additions & 0 deletions deploy.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
pipeline {
agent any

parameters {
string(name: 'IMAGE_NAME', defaultValue: 'beny14/polybot', description: 'Name of the Docker image')
string(name: 'BUILD_NUMBER', defaultValue: '', description: 'Build number of the Docker image to deploy')
}

stages {
stage('Push Docker Image to Nexus') {
steps {
withCredentials([usernamePassword(credentialsId: 'docker_nexus', usernameVariable: 'USERNAME', passwordVariable: 'USERPASS')]) {
script {
def dockerImage = "${params.IMAGE_NAME}:${params.BUILD_NUMBER}"
echo "Starting push of Docker image ${dockerImage} to Nexus"
sh """
echo ${USERPASS} | docker login localhost:8083 -u ${USERNAME} --password-stdin
docker tag ${dockerImage} localhost:8083/${dockerImage}
docker push localhost:8083/${dockerImage}
"""
echo "Docker push to Nexus completed "
}
}
}
}
}

post {
always {
echo "Pipeline completed"
}
failure {
echo "Pipeline failed"
}
}
}
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
app:
build:
context: ./polybot
dockerfile: Dockerfile
ports:
- "5000:5000"
volumes:
- .:/app
command: python3 -m bot.py

web:
build:
context: ./nginx
dockerfile: Dockerfile
ports:
- "8002:8002"
13 changes: 13 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Use the official Nginx image as the base image
FROM nginx:stable-perl

# Copy the Nginx configuration file into the container
COPY nginx.conf /etc/nginx/nginx.conf

# Copy the static website files into the container
COPY . /usr/share/nginx/html

# Expose the port that Nginx will run on
EXPOSE 8002

# Start Nginx (default command of the Nginx image)
12 changes: 12 additions & 0 deletions nginx/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to my DarkWeb</title>
</head>
<body>
<h1>Welcome to my DarkWeb !</h1>
<p>If you see this page, then we are watching you .</p>
</body>
</html>
21 changes: 21 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
events {
worker_connections 1024; # Adjust this number based on your requirements
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

server {
listen 8002;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html;
}

# Additional location blocks and configurations can be added here
}
}

39 changes: 39 additions & 0 deletions polybot/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Install system dependencies and build tools
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libglib2.0-0 \
libgl1-mesa-glx \
npm \
zlib1g-dev \
build-essential \
python3-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

# Install Snyk globally using npm
RUN npm install -g snyk

# Upgrade pip and install Python dependencies
COPY requirements.txt .
RUN python -m pip install --upgrade pip \
&& python -m pip install --no-cache-dir -r requirements.txt \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

COPY .env .env

# Copy the rest of the application code
COPY . .


# Ensure the directory structure is correct
RUN ls -la /app

# Set the working directory to /app
WORKDIR /app

# Expose port 5000
EXPOSE 5000

# Command to run the bot when the container launches
CMD ["python3", "-m", "polybot.bot"]
Loading