Merge branch 'feature/container-image' into 'master'

Add Container Image

Closes #1

See merge request s3lph/spaceapi-server!1
This commit is contained in:
s3lph 2020-06-20 02:41:38 +00:00
commit 5906c201ca
9 changed files with 79 additions and 6 deletions

View file

@ -1,5 +1,5 @@
--- ---
image: s3lph/spaceapi-server-ci:20191126-02 image: s3lph/spaceapi-server-ci:20200620-01
stages: stages:
- test - test
@ -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

View file

@ -88,7 +88,9 @@ invoke custom plugins, which look up and return your dynamic content.
Head over to the [Releases][releases], download and install the Head over to the [Releases][releases], download and install the
package that suits your needs. Alternatively, clone the repo and get package that suits your needs. Alternatively, clone the repo and get
started. started. There also is a Container Image available through the
[Gitlab registry][registry] tagged as
`registry.gitlab.com/s3lph/spaceapi-server`.
The remainder of this document assumes that you installed the The remainder of this document assumes that you installed the
server as an OS distribution package. server as an OS distribution package.
@ -348,3 +350,4 @@ def lookup_sensor(query, default=None):
[mit]: https://gitlab.com/s3lph/spaceapi-server/blob/master/LICENSE [mit]: https://gitlab.com/s3lph/spaceapi-server/blob/master/LICENSE
[spaceapi-getting-started]: https://spaceapi.io/getting-started/ [spaceapi-getting-started]: https://spaceapi.io/getting-started/
[jinja]: https://jinja.palletsprojects.com/ [jinja]: https://jinja.palletsprojects.com/
[registry]: https://gitlab.com/s3lph/spaceapi-server/container_registry

View file

@ -1,6 +1,6 @@
FROM python:3.8-buster as python FROM python:3.8-buster as python
RUN apt update \ RUN apt update \
&& apt install -y --no-install-recommends lintian rsync sudo \ && apt install -y --no-install-recommends lintian rsync sudo docker.io \
&& pip3 install pycodestyle coverage \ && pip3 install pycodestyle coverage \
&& rm -rf /var/cache/apt && rm -rf /var/cache/apt

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'