ci and docker

This commit is contained in:
Robin Appelman 2020-12-15 00:16:52 +01:00
commit be9cfc287e
3 changed files with 57 additions and 0 deletions

2
.dockerignore Normal file
View file

@ -0,0 +1,2 @@
.env
target

42
.github/workflows/rust.yml vendored Normal file
View file

@ -0,0 +1,42 @@
on: [push, pull_request]
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: check
build:
name: Build Binaries
runs-on: ubuntu-latest
steps:
- name: musl-tools
run: |
sudo apt-get install musl-tools
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target x86_64-unknown-linux-musl
- uses: actions/upload-artifact@v2
with:
name: tasproxy
path: target/x86_64-unknown-linux-musl/release/tasproxy

13
Dockerfile Normal file
View file

@ -0,0 +1,13 @@
FROM ekidd/rust-musl-builder AS build
ADD . ./
RUN sudo chown -R rust:rust .
RUN cargo build --release
FROM scratch
COPY --from=build /home/rust/src/target/x86_64-unknown-linux-musl/release/tasproxy /
EXPOSE 80
CMD ["/tasproxy"]