Skip to content

Commit

Permalink
chore: Atualizar suporte ao APKO e ao Melange, atualizar dependências
Browse files Browse the repository at this point in the history
  • Loading branch information
nataliagranato committed Aug 17, 2024
1 parent 8dd9ee4 commit ccfda11
Show file tree
Hide file tree
Showing 10 changed files with 750 additions and 23 deletions.
2 changes: 1 addition & 1 deletion chainguard/apko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ accounts:
uid: 65532
run-as: 65532
entrypoint:
command: /usr/bin/app
command: /usr/share/webapps/app/app
4 changes: 2 additions & 2 deletions chainguard/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
redis_user = os.environ.get("REDIS_USER")
redis_pass = os.environ.get("REDIS_PASS")

r = redis.StrictRedis(host=redis_host, port=redis_port, password=redis_pass, decode_responses=True)
r = redis.StrictRedis(host=redis_host, port=redis_port, password="", decode_responses=True)

senha_gerada_counter = Counter('senha_gerada', 'Contador de senhas geradas')

Expand Down Expand Up @@ -77,4 +77,4 @@ def ping():
return jsonify({"status": "healthy"}), 200

if __name__ == '__main__':
app.run(debug=False)
app.run(debug=False, host='0.0.0.0', port=5000)
47 changes: 47 additions & 0 deletions chainguard/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
services:
giropops-senhas:
# image: nataliagranato/giropops-senhas:v1.1.0
image: giropos-melange-apko:v1.0-amd64
ports:
- "5000:5000"
networks:
- giropops-senhas
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
volumes:
- natalia:/granato
deploy:
replicas: 1
resources:
reservations:
cpus: '0.25'
memory: 128M
limits:
cpus: '0.50'
memory: 256M
depends_on:
- redis

redis:
image: nataliagranato/redis:v1.0.0
networks:
- giropops-senhas
ports:
- "6380:6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s

networks:
giropops-senhas:
driver: bridge

volumes:
redis-data:
natalia:
Binary file added chainguard/giropops-senhas.tar
Binary file not shown.
26 changes: 6 additions & 20 deletions chainguard/melange.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,15 @@ environment:
- py3-pip
- py3-virtualenv

#pipeline:
#- name: Build Python application
# runs: |
# EXECDIR="${{targets.destdir}}/usr/bin"
# WEBAPPDIR="${{targets.destdir}}/usr/share/webapps/app"
# mkdir -p "${EXECDIR}" "${WEBAPPDIR}"
# echo "#!/usr/share/webapps/app/venv/bin/python3" > "${EXECDIR}/app"
# cat app.py >> "${EXECDIR}/app"
# chmod +x "${EXECDIR}/app"
# cp -r static "${EXECDIR}/"
# cp -r templates "${EXECDIR}/"
# virtualenv "${EXECDIR}/venv"
# sh -c "source '${EDIR}/venv/bin/activate' && pip install -r requirements.txt"


pipeline:
- name: Build Python application
runs: |
EXECDIR="${{targets.destdir}}/usr/bin"
WEBAPPDIR="${{targets.destdir}}/usr/share/webapps/app"
mkdir -p "${EXECDIR}" "${WEBAPPDIR}"
echo "#!/usr/share/webapps/app/venv/bin/python3" > "${EXECDIR}/app"
cat app.py >> "${EXECDIR}/app"
chmod +x "${EXECDIR}/app"
mkdir -p "${WEBAPPDIR}"
echo "#!/usr/share/webapps/app/venv/bin/python3" > "${WEBAPPDIR}/app"
cat app.py >> "${WEBAPPDIR}/app"
chmod +x "${WEBAPPDIR}/app"
cp -r templates "${WEBAPPDIR}"
cp -r static "${WEBAPPDIR}"
virtualenv "${WEBAPPDIR}/venv"
sh -c "source '${WEBAPPDIR}/venv/bin/activate' && pip install -r requirements.txt"
31 changes: 31 additions & 0 deletions chainguard/packages/x86_64/APKINDEX.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"Signature": null,
"Description": "",
"Packages": [
{
"Name": "giropops-senhas",
"Version": "0.1.0-r0",
"Arch": "x86_64",
"Description": "Um gerador de senhas.",
"License": "Apache-2.0",
"Origin": "giropops-senhas",
"Maintainer": "",
"URL": "",
"Checksum": "3Gaw+6uYvhvgSz0TsnaU8PiWjcw=",
"Dependencies": [
"python3",
"so:libc.musl-x86_64.so.1"
],
"Provides": null,
"InstallIf": null,
"Size": 6162989,
"InstalledSize": 17924626,
"ProviderPriority": 0,
"BuildTime": "1970-01-01T00:00:00Z",
"BuildDate": 0,
"RepoCommit": "",
"Replaces": null,
"DataHash": "521c0d317865196843353eb1c5768d97a400cf3457ea4e762058d6ea561e6fcc"
}
]
}
Binary file added chainguard/packages/x86_64/APKINDEX.tar.gz
Binary file not shown.
Binary file not shown.
73 changes: 73 additions & 0 deletions chainguard/sbom-index.spdx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"SPDXID": "SPDXRef-DOCUMENT",
"name": "sbom-sha256:a6d046f269ccf854eb5790febd602411dfe1075a0f1b8977725436d059a32507",
"spdxVersion": "SPDX-2.3",
"creationInfo": {
"created": "2024-08-13T15:22:27Z",
"creators": [
"Tool: apko (v0.14.7)",
"Organization: Chainguard, Inc"
],
"licenseListVersion": "3.16"
},
"dataLicense": "CC0-1.0",
"documentNamespace": "https://spdx.org/spdxdocs/apko/",
"documentDescribes": [
"SPDXRef-Package-sha256-a6d046f269ccf854eb5790febd602411dfe1075a0f1b8977725436d059a32507"
],
"packages": [
{
"SPDXID": "SPDXRef-Package-sha256-a6d046f269ccf854eb5790febd602411dfe1075a0f1b8977725436d059a32507",
"name": "sha256:a6d046f269ccf854eb5790febd602411dfe1075a0f1b8977725436d059a32507",
"versionInfo": "sha256:a6d046f269ccf854eb5790febd602411dfe1075a0f1b8977725436d059a32507",
"filesAnalyzed": false,
"description": "Multi-arch image index",
"downloadLocation": "NOASSERTION",
"supplier": "Organization: Chainguard, Inc.",
"sourceInfo": "Generated at image build time by apko",
"primaryPackagePurpose": "CONTAINER",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "a6d046f269ccf854eb5790febd602411dfe1075a0f1b8977725436d059a32507"
}
],
"externalRefs": [
{
"referenceCategory": "PACKAGE-MANAGER",
"referenceLocator": "pkg:oci/giropos-melange-apko@sha256%3Aa6d046f269ccf854eb5790febd602411dfe1075a0f1b8977725436d059a32507?mediaType=application%2Fvnd.oci.image.index.v1%2Bjson",
"referenceType": "purl"
}
]
},
{
"SPDXID": "SPDXRef-Package-sha256-cbef629874b3e2eaa41ff2869e616be1017336af239b5a0109e0bc26818a399b",
"name": "sha256:cbef629874b3e2eaa41ff2869e616be1017336af239b5a0109e0bc26818a399b",
"versionInfo": "sha256:cbef629874b3e2eaa41ff2869e616be1017336af239b5a0109e0bc26818a399b",
"filesAnalyzed": false,
"downloadLocation": "NOASSERTION",
"supplier": "Organization: Chainguard, Inc.",
"primaryPackagePurpose": "CONTAINER",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "cbef629874b3e2eaa41ff2869e616be1017336af239b5a0109e0bc26818a399b"
}
],
"externalRefs": [
{
"referenceCategory": "PACKAGE-MANAGER",
"referenceLocator": "pkg:oci/giropos-melange-apko@sha256%3Acbef629874b3e2eaa41ff2869e616be1017336af239b5a0109e0bc26818a399b?arch=amd64\u0026mediaType=application%2Fvnd.oci.image.manifest.v1%2Bjson\u0026os=linux",
"referenceType": "purl"
}
]
}
],
"relationships": [
{
"spdxElementId": "SPDXRef-Package-sha256-a6d046f269ccf854eb5790febd602411dfe1075a0f1b8977725436d059a32507",
"relationshipType": "VARIANT_OF",
"relatedSpdxElement": "SPDXRef-Package-sha256-cbef629874b3e2eaa41ff2869e616be1017336af239b5a0109e0bc26818a399b"
}
]
}
Loading

0 comments on commit ccfda11

Please sign in to comment.