mirror of
https://github.com/deps-rs/deps.rs.git
synced 2024-11-23 10:56:29 +00:00
Setup CD: Docker image and action to push to GH container registry (#61)
This commit is contained in:
parent
8b58821beb
commit
f184566d1a
3 changed files with 70 additions and 0 deletions
3
.dockerignore
Normal file
3
.dockerignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
/target
|
||||
/Dockerfile
|
||||
/.qovery.yml
|
30
.github/workflows/deployment.yml
vendored
Normal file
30
.github/workflows/deployment.yml
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
name: Deployment
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build-docker-image:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}:latest
|
37
Dockerfile
Normal file
37
Dockerfile
Normal file
|
@ -0,0 +1,37 @@
|
|||
FROM buildpack-deps:buster as build
|
||||
|
||||
ENV RUSTUP_HOME=/usr/local/rustup \
|
||||
CARGO_HOME=/usr/local/cargo \
|
||||
PATH=/usr/local/cargo/bin:$PATH
|
||||
|
||||
COPY rust-toolchain /src/
|
||||
|
||||
RUN set -eux; \
|
||||
\
|
||||
url="https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init"; \
|
||||
wget "$url"; \
|
||||
chmod +x rustup-init; \
|
||||
./rustup-init -y --no-modify-path --default-toolchain $(cat /src/rust-toolchain); \
|
||||
rm rustup-init; \
|
||||
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
|
||||
rustup --version; \
|
||||
cargo --version; \
|
||||
rustc --version;
|
||||
|
||||
COPY . /src
|
||||
RUN cargo install --path /src
|
||||
|
||||
FROM debian:buster
|
||||
|
||||
LABEL org.opencontainers.image.source https://github.com/deps-rs/deps.rs
|
||||
|
||||
RUN set -ex; \
|
||||
apt-get update; \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get install -y --no-install-recommends libssl-dev; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=build /usr/local/cargo/bin/shiny-robots /usr/local/bin
|
||||
|
||||
EXPOSE 8080
|
||||
CMD /usr/local/bin/shiny-robots
|
Loading…
Reference in a new issue