docker stuff

This commit is contained in:
41666 2022-11-20 22:19:55 -05:00
parent e5c845a159
commit 75ab42ecb5
5 changed files with 53 additions and 8 deletions

3
.dockerignore Normal file
View file

@ -0,0 +1,3 @@
target
Dockerfile
.git

29
.github/workflows/ci.yaml vendored Normal file
View file

@ -0,0 +1,29 @@
name: "CI"
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
service: ["api", "tasks", "websocket"]
steps:
- uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
docker build . \
--build-arg SERVICE=${{ matrix.service }} \
-t ghcr.io/${{ github.repository }}/${{ matrix.service }}:${{ github.sha }}
- run: |
docker tag ghcr.io/${{ github.repository }}/${{ matrix.service }}:${{ github.sha }} \
ghcr.io/${{ github.repository }}/${{ matrix.service }}:latest
if: github.ref == 'refs/heads/main'
- run: |
docker push ghcr.io/${{ github.repository }}/${{ matrix.service }}

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
FROM rust:1.65.0-alpine AS builder
ARG SERVICE
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY services ./services
RUN cargo build --bin ${SERVICE} --release
FROM alpine AS target
ARG SERVICE
COPY --from=builder /app/target/release/${SERVICE} /app
RUN chmod a+x /app
CMD /app

View file

@ -64,8 +64,8 @@ This API only supports GET, and supports CORS.
## Architecture ## Architecture
- Websocket processors - Websocket processors
- One pair per PC, PS4US, PS4EU - One per PC, PS4US, PS4EU
- Each pair connects to either Census Websocket or NS Websocket, depending on availability. - Connects to [wss://push.nanite-systems.net](https://nanite-systems.net), one process per "environment"
- API - API
- Serves https://saerro.harasse.rs - Serves https://saerro.harasse.rs
- Redis - Redis

View file

@ -110,12 +110,8 @@ async fn main() {
let init = tokio::spawn(send_init(tx.clone())); let init = tokio::spawn(send_init(tx.clone()));
futures::select! { futures::select! {
_ = fused_reader => { _ = fused_reader => {}
println!("Reader finished"); _ = fused_writer => {}
}
_ = fused_writer => {
println!("Writer finished");
}
} }
init.await.unwrap(); init.await.unwrap();