Add a Dockerfile and initial DroneCI configuration.
continuous-integration/drone Build is failing
Details
continuous-integration/drone Build is failing
Details
This commit is contained in:
parent
5e390951f0
commit
055aad7a90
|
@ -0,0 +1,4 @@
|
||||||
|
target/
|
||||||
|
Cargo.lock
|
||||||
|
**/*.rs.bk
|
||||||
|
.idea
|
|
@ -0,0 +1,57 @@
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: mirror-server
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: create-build-image
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
username:
|
||||||
|
from_secret: docker-username
|
||||||
|
password:
|
||||||
|
from_secret: docker-password
|
||||||
|
registry: code.birch-tree.net
|
||||||
|
repo: code.birch-tree.net/dorian/mirror-server
|
||||||
|
target: BUILD
|
||||||
|
tags:
|
||||||
|
- build
|
||||||
|
cache_from:
|
||||||
|
- code.birch-tree.net/dorian/mirror-server:build
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
image: code.birch-tree.net/dorian/mirror-server:build
|
||||||
|
commands:
|
||||||
|
- cargo test
|
||||||
|
depends_on:
|
||||||
|
- create-build-image
|
||||||
|
|
||||||
|
- name: create-release-image
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
username:
|
||||||
|
from_secret: docker-username
|
||||||
|
password:
|
||||||
|
from_secret: docker-password
|
||||||
|
registry: code.birch-tree.net
|
||||||
|
repo: code.birch-tree.net/dorian/mirror-server
|
||||||
|
tags:
|
||||||
|
- 0.3.0
|
||||||
|
- latest
|
||||||
|
cache_from:
|
||||||
|
- code.birch-tree.net/dorian/mirror-server:latest
|
||||||
|
- code.birch-tree.net/dorian/mirror-server:build
|
||||||
|
depends_on:
|
||||||
|
- test
|
||||||
|
|
||||||
|
- name: create-debian-package
|
||||||
|
image: code.birch-tree.net/dorian/mirror-server:build
|
||||||
|
commands:
|
||||||
|
- cargo deb
|
||||||
|
# - TODO: Add a publish step based on the publish-deb.sh
|
||||||
|
depends_on:
|
||||||
|
- test
|
||||||
|
|
||||||
|
|
||||||
|
image_pull_secrets:
|
||||||
|
- docker-config
|
|
@ -0,0 +1,38 @@
|
||||||
|
FROM rust:1.76 AS BUILD
|
||||||
|
|
||||||
|
ENV APP_NAME=mirror-server
|
||||||
|
ENV APP_HOME=/srv/${APP_NAME}
|
||||||
|
RUN apt update \
|
||||||
|
&& apt install -y curl \
|
||||||
|
&& cargo install cargo-deb
|
||||||
|
|
||||||
|
# Setup working env.
|
||||||
|
RUN mkdir -p ${APP_HOME}
|
||||||
|
WORKDIR ${APP_HOME}
|
||||||
|
|
||||||
|
# Create build target cache.
|
||||||
|
RUN USER=root cargo init --bin .
|
||||||
|
COPY ["Cargo.toml", "Cargo.lock", "./"]
|
||||||
|
RUN cargo build \
|
||||||
|
&& cargo build --tests \
|
||||||
|
&& cargo build --release \
|
||||||
|
&& rm src/*.rs
|
||||||
|
|
||||||
|
# Bring in the source
|
||||||
|
COPY ["src", "./src/"]
|
||||||
|
|
||||||
|
# Build the example API.
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
# Create the minimal server image.
|
||||||
|
FROM debian:buster-slim AS SERVER
|
||||||
|
|
||||||
|
ENV APP_NAME=mirror-server
|
||||||
|
ENV APP_HOME=/srv/${APP_NAME}
|
||||||
|
RUN apt update
|
||||||
|
|
||||||
|
RUN mkdir -p ${APP_HOME}
|
||||||
|
WORKDIR ${APP_HOME}
|
||||||
|
|
||||||
|
COPY --from=BUILD ${APP_HOME}/target/release/${APP_NAME} /usr/local/bin/
|
||||||
|
CMD ${APP_NAME}
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
A simple server for mirroring HTTP requests for testing.
|
A simple server for mirroring HTTP requests for testing.
|
||||||
|
|
||||||
|
[![Build Status](https://ci.birch-tree.net/api/badges/dorian/mirror-server/status.svg)](https://ci.birch-tree.net/dorian/mirror-server)
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
* Use the latest stable version of Rust using rustup.
|
* Use the latest stable version of Rust using rustup.
|
||||||
|
@ -29,9 +31,7 @@ sudo dpkg -i "mirror-server-${VERSION}_amd64.deb"
|
||||||
* [x] Migrate actix to axum for easier maintainability.
|
* [x] Migrate actix to axum for easier maintainability.
|
||||||
* [x] Add mirroring of JSON request.
|
* [x] Add mirroring of JSON request.
|
||||||
* [x] Add logging to server.
|
* [x] Add logging to server.
|
||||||
* [x] ~~Add convenience path to access logging for a certain date / records.~~
|
* [x] Create Docker image for mirror-server for easier distribution.
|
||||||
* [ ] Create Docker image for mirror-server for easier distribution.
|
|
||||||
* [ ] Add publishing of DEB and Docker image to DroneCI.
|
* [ ] Add publishing of DEB and Docker image to DroneCI.
|
||||||
* [ ] Add OpenAPI/Swagger UI
|
|
||||||
* [ ] Add documentation to the API.
|
* [ ] Add documentation to the API.
|
||||||
* [ ] Publish crate on <https://crates.io/>.
|
* [ ] Publish crate on <https://crates.io/>.
|
||||||
|
|
Loading…
Reference in New Issue