Add a CI step to create a container image

This commit is contained in:
s3lph 2020-06-20 03:42:14 +02:00
parent d210e05d7e
commit 79fae47918
7 changed files with 73 additions and 3 deletions

View file

@ -141,6 +141,19 @@ build_archlinux:
only: only:
- tags - tags
build_docker:
stage: build
script:
- docker build -t "registry.gitlab.com/s3lph/spaceapi-server:$CI_COMMIT_SHA" -f package/docker/Dockerfile .
- docker tag "registry.gitlab.com/s3lph/spaceapi-server:$CI_COMMIT_SHA" "registry.gitlab.com/s3lph/spaceapi-server:$CI_COMMIT_REF_NAME"
- if [[ -n "$CI_COMMIT_TAG" ]]; then docker tag "registry.gitlab.com/s3lph/spaceapi-server:$CI_COMMIT_SHA" "registry.gitlab.com/s3lph/spaceapi-server:$CI_COMMIT_TAG"; fi
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_TOKEN registry.gitlab.com
- docker push "registry.gitlab.com/s3lph/spaceapi-server:$CI_COMMIT_SHA"
- docker push "registry.gitlab.com/s3lph/spaceapi-server:$CI_COMMIT_REF_NAME"
- if [[ -n "$CI_COMMIT_TAG" ]]; then docker push "registry.gitlab.com/s3lph/spaceapi-server:$CI_COMMIT_TAG"; fi
only:
- tags
release: release:
@ -148,4 +161,4 @@ release:
script: script:
- python3 package/release.py - python3 package/release.py
only: only:
- tags - tags

View file

@ -1,5 +1,18 @@
# SpaceAPI Server Changelog # SpaceAPI Server Changelog
<!-- BEGIN RELEASE v0.3.1 -->
## Version 0.3
Container image release
### Changes
<!-- BEGIN CHANGES 0.3.1 -->
- Release as container image
<!-- END CHANGES 0.3.1 -->
<!-- END RELEASE v0.3.1 -->
<!-- BEGIN RELEASE v0.3 --> <!-- BEGIN RELEASE v0.3 -->
## Version 0.3 ## Version 0.3

13
package/docker/Dockerfile Normal file
View file

@ -0,0 +1,13 @@
FROM python:3.8-alpine
ADD spaceapi_server/ /spaceapi_server/
ADD setup.py /setup.py
RUN python setup.py install && mkdir -p /config/plugins && chmod 0755 -R /config
ADD package/docker/config.json /config/config.json
ADD package/docker/template.json /config/template.json
VOLUME /config
EXPOSE 8000/tcp
USER 1000
ENTRYPOINT [ "/usr/local/bin/python3.8", "-m", "spaceapi_server", "/config/config.json" ]

View file

@ -0,0 +1,8 @@
{
"address": "0.0.0.0",
"port": 8000,
"server": "wsgiref",
"template": "/config/template.json",
"plugins_dir": "/config/plugins",
"plugins": {}
}

View file

@ -0,0 +1,23 @@
{
"api": "0.13",
"space": "example.space",
"logo": "http://example.space/logo.png",
"url": "http://example.space",
"location": {
"address": "example.space, 42 Example Street, 1337 Example Town",
"lon": 42.42,
"lat": 13.37
},
"contact": {
"email": "example@example.space"
},
"issue_report_channels": [
"email"
],
"state": {
"open": null
},
"projects": [
"http://example.space/projects"
]
}

View file

@ -19,7 +19,7 @@ setup(
python_requires='>=3.6', python_requires='>=3.6',
install_requires=[ install_requires=[
'bottle', 'bottle',
'jinja2' 'jinja2==2.10'
], ],
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [

View file

@ -1,2 +1,2 @@
__version__ = '0.3' __version__ = '0.3.1'