mirror of
https://github.com/status-im/spiffworkflow-connector.git
synced 2025-02-22 11:38:17 +00:00
Merge pull request #30 from sartography/ci/add-jenkinsfile
Jenkinsfile: add CI Docker image build for Jenkins
This commit is contained in:
commit
4549ba8745
38
Dockerfile
38
Dockerfile
@ -1,15 +1,24 @@
|
||||
FROM ghcr.io/sartography/python:3.11
|
||||
FROM ghcr.io/sartography/python:3.11 AS base
|
||||
|
||||
ARG commit
|
||||
|
||||
# Prepare Python virtual environment
|
||||
ENV VIRTUAL_ENV=/app/venv
|
||||
RUN python3 -m venv $VIRTUAL_ENV
|
||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
RUN pip install poetry
|
||||
RUN useradd _gunicorn --no-create-home --user-group
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
FROM base AS setup
|
||||
|
||||
RUN pip install poetry
|
||||
# libpq-dev for pg_config executable, which is needed for psycopg2
|
||||
RUN set -xe \
|
||||
&& apt-get update -q \
|
||||
&& apt-get install -y -q \
|
||||
RUN apt-get update -q \
|
||||
&& apt-get install -y -q \
|
||||
libpq-dev
|
||||
|
||||
WORKDIR /app
|
||||
ADD pyproject.toml poetry.lock /app/
|
||||
ADD connectors /app/connectors
|
||||
RUN poetry install
|
||||
@ -20,16 +29,11 @@ COPY . /app/
|
||||
# otherwise it does not know what the main app module is
|
||||
RUN poetry install
|
||||
|
||||
# remove packages that are not needed in production.
|
||||
# just for security. won't help image size.
|
||||
RUN set -xe \
|
||||
&& apt-get remove -y \
|
||||
gcc \
|
||||
libssl-dev \
|
||||
postgresql-client \
|
||||
python3-dev \
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
FROM base AS final
|
||||
|
||||
LABEL source="https://github.com/sartography/connector-proxy-status-im"
|
||||
LABEL description="Connector gateway for external services."
|
||||
|
||||
COPY --from=setup /app /app
|
||||
|
||||
ENTRYPOINT ["/app/bin/boot_server_in_docker"]
|
||||
|
48
Jenkinsfile
vendored
Normal file
48
Jenkinsfile
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
pipeline {
|
||||
agent { label 'linux' }
|
||||
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 20, unit: 'MINUTES')
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '30',
|
||||
))
|
||||
}
|
||||
|
||||
parameters {
|
||||
choice(
|
||||
name: 'IMAGE_TAG',
|
||||
description: 'Name of Docker tag to push. Chose wisely.',
|
||||
choices: ['latest', 'deploy-app-dev', 'deploy-mod-dev', 'deploy-app-test', 'deploy-mod-test'],
|
||||
)
|
||||
string(
|
||||
name: 'IMAGE_NAME',
|
||||
description: 'Name of Docker image to push.',
|
||||
defaultValue: params.IMAGE_NAME ?: 'statusteam/spiffworkflow-connector',
|
||||
)
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps { script {
|
||||
image = docker.build(
|
||||
"${params.IMAGE_NAME}:${env.GIT_COMMIT.take(8)}",
|
||||
"--label=commit='${env.GIT_COMMIT.take(8)}' ."
|
||||
)
|
||||
} }
|
||||
}
|
||||
|
||||
stage('Push') {
|
||||
steps { script {
|
||||
withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) {
|
||||
image.push()
|
||||
image.push(env.IMAGE_TAG)
|
||||
}
|
||||
} }
|
||||
}
|
||||
} // stages
|
||||
post {
|
||||
always { sh 'docker image prune -f' }
|
||||
} // post
|
||||
} // pipeline
|
Loading…
x
Reference in New Issue
Block a user