diff --git a/.github/workflows/publish-to-gpr.yml b/.github/workflows/publish-to-gpr.yml new file mode 100644 index 0000000000..c5a4642438 --- /dev/null +++ b/.github/workflows/publish-to-gpr.yml @@ -0,0 +1,22 @@ +name: Publish Docker image to GitHub Package Registry +on: push +jobs: + build: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' # Only on master + + steps: + - name: Copy Repo Files + uses: actions/checkout@master + + #This Action Emits 2 Variables, IMAGE_SHA_NAME and IMAGE_URL + #which you can reference in subsequent steps + - name: Publish Docker Image to GPR + uses: machine-learning-apps/gpr-docker-publish@master + id: docker + with: + IMAGE_NAME: 'do-spaces-downloader' + DOCKERFILE_PATH: 'Dockerfile' + BUILD_CONTEXT: '.' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..b421b2b798 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +# Unsure if I want to create minimal images yet that run under Alpine Linux. +# I have instructions for that here: https://hub.docker.com/r/echelon/testcontainer/dockerfile +FROM ubuntu:xenial as build +WORKDIR /tmp +RUN apt-get update \ + && apt-get install -y \ + build-essential \ + curl \ + libssl-dev \ + libssl1.0.0 \ + pkg-config \ + unzip \ + wget +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ + | sh -s -- --default-toolchain stable -y + +COPY Cargo.lock . +COPY Cargo.toml . +COPY src/ ./src + +RUN $HOME/.cargo/bin/cargo fetch + +#RUN $HOME/.cargo/bin/cargo build +RUN $HOME/.cargo/bin/cargo build --release + +# Final image +FROM ubuntu:xenial +WORKDIR / +#COPY --from=build /tmp/target/debug/do_spaces_downloader / +COPY --from=build /tmp/target/release/do_spaces_downloader / +COPY --from=build /lib/x86_64-linux-gnu/libssl.so.1.0.0 /lib/x86_64-linux-gnu +COPY --from=build /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /lib/x86_64-linux-gnu + +CMD LD_LIBRARY_PATH=/usr/lib /do_spaces_downloader +