forked from thirtythreeforty/neolink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Docker image based on Alpine
- Loading branch information
1 parent
22e2dfb
commit 0f5c6ec
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target/ | ||
Dockerfile | ||
.dockerignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# A single-shot build-n-pack on Alpine Linux | ||
name: Publish Docker image | ||
on: [push] | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Build Docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
- name: Push to Docker Hub | ||
uses: docker/build-push-action@v1 | ||
with: | ||
username: thirtythreeforty | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
registry: docker.io | ||
repository: thirtythreeforty/neolink | ||
tag_with_ref: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Neolink Docker image build scripts | ||
# Copyright (c) 2020 George Hilliard | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
FROM docker.io/rust:1-alpine AS build | ||
MAINTAINER [email protected] | ||
|
||
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ | ||
gst-rtsp-server-dev | ||
RUN apk add --no-cache musl-dev gcc | ||
|
||
# Use static linking to work around https://github.com/rust-lang/rust/pull/58575 | ||
ENV RUSTFLAGS='-C target-feature=-crt-static' | ||
|
||
# Compile dependencies before main app to save rebuild time | ||
# https://github.com/errmac-v/cargo-build-dependencies | ||
RUN cargo install cargo-build-dependencies | ||
RUN mkdir /usr/local/src \ | ||
&& cd /usr/local/src \ | ||
&& USER=root cargo new --bin neolink | ||
WORKDIR /usr/local/src/neolink | ||
COPY Cargo.toml Cargo.lock ./ | ||
RUN cargo build-dependencies --release | ||
|
||
# Build the main program | ||
COPY . /usr/local/src/neolink | ||
RUN cargo build --release | ||
|
||
# Create the release container. Match the base OS used to build | ||
FROM docker.io/alpine:latest | ||
|
||
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing gst-rtsp-server | ||
RUN apk add libgcc | ||
|
||
COPY --from=build \ | ||
/usr/local/src/neolink/target/release/neolink \ | ||
/usr/local/bin/neolink | ||
COPY docker/entrypoint.sh /entrypoint.sh | ||
|
||
CMD ["/usr/local/bin/neolink", "--config", "/etc/neolink.toml"] | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
EXPOSE 8554 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
# Allows Ctrl-C, by letting this sh process act as PID 1 | ||
exit_func() { | ||
exit 1 | ||
} | ||
trap exit_func SIGTERM SIGINT | ||
|
||
"$@" |