Compare commits

...

4 Commits

Author SHA1 Message Date
b52d657c6d Merge pull request 'build: init versioning in repository' (#4) from develop into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #4
2022-08-01 14:37:47 +02:00
5acc952f3c build: init versioning in repository
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #3
PR #3
2022-08-01 14:36:04 +02:00
0565f6b330 Merge pull request 'feat: inital version of a static webserver' (#2) from develop into main
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #2
2022-08-01 14:29:11 +02:00
044aedc05a feat: inital version of a static webserver
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #1
PR #1
2022-08-01 14:27:29 +02:00
7 changed files with 167 additions and 1 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
*

120
.drone.yml Normal file
View File

@ -0,0 +1,120 @@
---
kind: pipeline
type: docker
name: main
steps:
- name: Fetch tags
image: alpine/git
commands:
- git fetch --tags
- name: Update version and changelog
image: registry.riba-interactive.de/conventi:0.1.0
- name: Commit changelog updates
image: alpine/git
commands:
- git add .
- git commit -m "version and changelog update [CI SKIP]"
- git push origin $DRONE_TARGET_BRANCH
- name: Tag commit
image: registry.riba-interactive.de/conventi:0.1.0
commands:
- export VERSION=$(conventi.sh get_version)
- git tag -am "Tagging new version $VERSION" "$VERSION"
- git push origin "$VERSION"
trigger:
branch:
- main
event:
- push
image_pull_secrets:
- dockerconfig
---
kind: pipeline
type: docker
name: tag
steps:
- name: Build release
image: docker:dind
volumes:
- name: dockersock
path: /var/run
environment:
DOCKER_USER:
from_secret: docker_user
DOCKER_PASSWORD:
from_secret: docker_password
commands:
- sleep 5 # give docker enough time to start
- echo "$DOCKER_PASSWORD" | docker login --username $DOCKER_USER --password-stdin registry.riba-interactive.de
- docker pull registry.riba-interactive.de/statically:latest || true
- DOCKER_BUILDKIT=1 docker build --cache-from registry.riba-interactive.de/statically:latest --tag registry.riba-interactive.de/statically:latest .
- docker tag registry.riba-interactive.de/statically:latest registry.riba-interactive.de/statically:$DRONE_TAG
- docker push --all-tags registry.riba-interactive.de/statically
trigger:
event:
- tag
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
image_pull_secrets:
- dockerconfig
---
kind: pipeline
type: docker
name: Build and Test
steps:
- name: Build image
image: docker:dind
volumes:
- name: dockersock
path: /var/run
environment:
DOCKER_USER:
from_secret: docker_user
DOCKER_PASSWORD:
from_secret: docker_password
commands:
- sleep 5 # give docker enough time to start
- echo "$DOCKER_PASSWORD" | docker login --username $DOCKER_USER --password-stdin registry.riba-interactive.de
- docker pull registry.riba-interactive.de/statically:latest || true
- DOCKER_BUILDKIT=1 docker build --cache-from registry.riba-interactive.de/statically:latest --tag registry.riba-interactive.de/statically:latest .
- docker tag registry.riba-interactive.de/statically:latest registry.riba-interactive.de/statically:build-$DRONE_BUILD_NUMBER
- docker push --all-tags registry.riba-interactive.de/statically
trigger:
branch:
- develop
- feature/*
- bugfix/*
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
image_pull_secrets:
- dockerconfig
...

5
.version.json Normal file
View File

@ -0,0 +1,5 @@
{
"version": "0.0.0",
"sha": "",
"url": "https://git.riba-interactive.de/rick/statically"
}

8
CHANGELOG.md Normal file
View File

@ -0,0 +1,8 @@
# Changelog
All notable changes to this project will be documented in this file. See [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for commit guidelines.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
----

31
Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM alpine:3.16.0 AS builder
ARG THTTPD_VERSION=2.29
RUN apk add gcc musl-dev make
RUN wget http://www.acme.com/software/thttpd/thttpd-${THTTPD_VERSION}.tar.gz \
&& tar xzf thttpd-${THTTPD_VERSION}.tar.gz \
&& mv /thttpd-${THTTPD_VERSION} /thttpd
RUN cd /thttpd \
&& ./configure \
&& make CCOPT='-O2 -s -static' thttpd
RUN adduser -D www --home /var/www
FROM scratch
EXPOSE 3000
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /thttpd/thttpd /usr/local/bin/
USER www
WORKDIR /var/www/htdocs
# Copy the static website
# Use the .dockerignore file to control what ends up inside the image!
COPY . .
# Run thttpd
CMD ["/usr/local/bin/thttpd", "-D", "-h", "0.0.0.0", "-p", "3000", "-d", "/var/www/htdocs", "-u", "www", "-l", "-", "-M", "60"]

View File

@ -1,4 +1,4 @@
Copyright (c) year copyright holder. All Rights Reserved.
Copyright (c) 2022 Rick Barenthin. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

View File

@ -1,2 +1,3 @@
# statically
[![Build Status](https://drone.riba-interactive.de/api/badges/rick/statically/status.svg)](https://drone.riba-interactive.de/rick/statically)