add binary
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Christoph Honal 2020-02-14 09:50:27 +01:00
parent 8c4705a755
commit 264270213e
3 changed files with 38 additions and 4 deletions

View File

@ -1,7 +1,24 @@
FROM alpine
# build stage
FROM ubuntu:18.04 AS build
ENV DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin
RUN apk update && apk add bash
RUN apt-get update && \
apt-get -y install --no-install-recommends g++ && \
rm -rf /var/lib/apt/lists/*
COPY main.cpp /app/main.cpp
WORKDIR /app
RUN g++ -o main main.cpp
# run stage
FROM ubuntu:18.04 AS run
ENV DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin
RUN apt-get update && \
apt-get -y install --no-install-recommends file && \
rm -rf /var/lib/apt/lists/*
COPY --from=build /app/main /app/main
COPY run.sh /app/run.sh
RUN chmod +x /app/run.sh
CMD ["/app/run.sh"]

14
main.cpp Normal file
View File

@ -0,0 +1,14 @@
#include <iostream>
#include <sys/utsname.h>
using namespace std;
struct utsname unameData;
int main()
{
cout << "Hello from binary!" << endl;
uname(&unameData);
printf("Running on %s, %s\n", unameData.sysname, unameData.machine);
return 0;
}

5
run.sh
View File

@ -1,3 +1,6 @@
#!/bin/bash
echo "Hello CI!"
echo "Hello from entrypoint!"
file /app/main
ldd /app/main
/app/main