Merge remote-tracking branch 'origin/main'

This commit is contained in:
stephb9959
2021-07-09 10:19:45 -07:00
3 changed files with 137 additions and 0 deletions

54
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
name: CI
on:
push:
paths-ignore:
- 'openapi/**'
- '**.md'
branches:
- main
pull_request:
branches:
- main
defaults:
run:
shell: bash
jobs:
docker:
runs-on: ubuntu-20.04
env:
DOCKER_REGISTRY_URL: tip-tip-wlan-cloud-ucentral.jfrog.io
DOCKER_REGISTRY_USERNAME: ucentral
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: docker build -t wlan-cloud-ucentralfms:${{ github.sha }} .
- name: Log into Docker registry
uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_REGISTRY_URL }}
username: ${{ env.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Push Docker image
run: |
TAGS="${{ github.sha }}"
if [ ${GITHUB_REF} == "refs/heads/main" ]
then
TAGS="$TAGS ${GITHUB_REF#refs/heads/}"
else # PR build
CURRENT_TAG=$(echo ${GITHUB_HEAD_REF#refs/heads/} | tr '/' '-')
TAGS="$TAGS $CURRENT_TAG"
fi
echo "Pushing tags $TAGS"
for tag in $TAGS; do
docker tag wlan-cloud-ucentralfms:${{ github.sha }} ${{ env.DOCKER_REGISTRY_URL }}/ucentralfms:$tag
docker push ${{ env.DOCKER_REGISTRY_URL }}/ucentralfms:$tag
done

19
.github/workflows/cleanup.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Clean up PR Docker images
on:
pull_request:
branches:
- main
types: [ closed ]
defaults:
run:
shell: bash
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- run: |
export PR_BRANCH_TAG=$(echo ${GITHUB_HEAD_REF#refs/heads/} | tr '/' '-')
curl -uucentral:${{ secrets.DOCKER_REGISTRY_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral/ucentralfms/$PR_BRANCH_TAG"

64
Dockerfile Normal file
View File

@@ -0,0 +1,64 @@
FROM alpine AS builder
RUN apk update && \
apk add --no-cache openssl openssh && \
apk add --no-cache ncurses-libs && \
apk add --no-cache bash util-linux coreutils curl && \
apk add --no-cache make cmake gcc g++ libstdc++ libgcc git && \
apk add --no-cache openssl-dev boost-dev curl-dev util-linux-dev zlib-dev && \
apk add --no-cache librdkafka-dev
RUN git clone https://github.com/stephb9959/poco /poco
RUN git clone https://github.com/stephb9959/cppkafka /cppkafka
RUN git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp /aws-sdk-cpp
WORKDIR /aws-sdk-cpp
RUN mkdir cmake-build
WORKDIR cmake-build
RUN cmake .. -DBUILD_ONLY="s3" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-Wno-error=stringop-overflow -Wno-error=uninitialized" \
-DAUTORUN_UNIT_TESTS=OFF
RUN cmake --build . --config Release -j8
RUN cmake --build . --target install
WORKDIR /cppkafka
RUN mkdir cmake-build
WORKDIR cmake-build
RUN cmake ..
RUN cmake --build . --config Release -j8
RUN cmake --build . --target install
WORKDIR /poco
RUN mkdir cmake-build
WORKDIR cmake-build
RUN cmake ..
RUN cmake --build . --config Release -j8
RUN cmake --build . --target install
ADD CMakeLists.txt /ucentralfms/
ADD src /ucentralfms/src
WORKDIR /ucentralfms
RUN mkdir cmake-build
WORKDIR /ucentralfms/cmake-build
RUN cmake ..
RUN cmake --build . --config Release -j8
FROM alpine
RUN mkdir /ucentral
RUN mkdir /ucentralfms-data
RUN apk add --update --no-cache librdkafka curl-dev
COPY --from=builder /ucentralfms/cmake-build/ucentralfms /ucentral/ucentralfms
COPY --from=builder /cppkafka/cmake-build/src/lib/* /lib/
COPY --from=builder /poco/cmake-build/lib/* /lib/
COPY --from=builder /aws-sdk-cpp/cmake-build/aws-cpp-sdk-core/libaws-cpp-sdk-core.so /lib/
COPY --from=builder /aws-sdk-cpp/cmake-build/aws-cpp-sdk-s3/libaws-cpp-sdk-s3.so /lib/
EXPOSE 16004
EXPOSE 17004
EXPOSE 16104
ENTRYPOINT /ucentral/ucentralfms