From c51d855d9c06fd1e46670db1e045eab5881bed1b Mon Sep 17 00:00:00 2001 From: Justine Pelletreau Date: Sat, 22 Jul 2023 19:44:50 +0200 Subject: [PATCH] Added dockerfile --- .gitea/workflows/build.yml | 26 ++++++++++++++++++++++++++ Dockerfile | 10 ++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Dockerfile diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index a8b3029..6995601 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -47,3 +47,29 @@ jobs: - name: Build run: cargo build --release + + - name: Build + run: cargo build --release + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to registry + uses: docker/login-action@v2 + with: + registry: gitea.squi.fr + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v4 + env: + ACTIONS_RUNTIME_TOKEN: '' # See https://gitea.com/gitea/act_runner/issues/119 + with: + context: . + file: ./Dockerfile + platforms: | + linux/amd64 + linux/arm64 + push: true + tags: gitea.squi.fr/justine/portnut:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e55afbd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM rust:slim-buster +RUN mkdir -p /opt/portnut +COPY --chown=root --chmod=0755 ./src /opt/portnut/src +COPY --chown=root --chmod=0755 ./Cargo.toml /opt/portnut/Cargo.toml +RUN apt update +RUN apt install libssl-dev openssl pkg-config -y +WORKDIR /opt/portnut +RUN cargo build --release +RUN cp target/release/portnut /bin/portnut +CMD ["/bin/portnut"]