This commit is contained in:
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
.git
|
||||||
|
target
|
||||||
|
README.md
|
||||||
|
Dockerfile
|
24
.gitea/workflows/build.yaml
Normal file
24
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: woryzen
|
||||||
|
steps:
|
||||||
|
- name: Login to Gitea container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gitea.woggioni.net
|
||||||
|
username: woggioni
|
||||||
|
password: ${{ secrets.PUBLISHER_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build rbcs Docker image
|
||||||
|
uses: docker/build-push-action@v5.3.0
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
pull: true
|
||||||
|
tags: |
|
||||||
|
gitea.woggioni.net/woggioni/intrasys:latest
|
||||||
|
cache-from: type=registry,ref=gitea.woggioni.net/woggioni/intrasys:buildx
|
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
FROM alpine:latest AS base
|
||||||
|
|
||||||
|
FROM alpine:latest AS build
|
||||||
|
RUN --mount=type=cache,target=/var/cache/apk apk update
|
||||||
|
RUN --mount=type=cache,target=/var/cache/apk apk add rustup binutils gcc musl-dev linux-headers
|
||||||
|
RUN adduser -D luser
|
||||||
|
USER luser
|
||||||
|
WORKDIR /home/luser
|
||||||
|
RUN rustup-init -y --profile minimal --target x86_64-unknown-linux-musl
|
||||||
|
ADD --chown=luser:users . .
|
||||||
|
RUN source $HOME/.cargo/env && cargo build --release --target x86_64-unknown-linux-musl
|
||||||
|
|
||||||
|
|
||||||
|
FROM scratch AS release
|
||||||
|
COPY --from=build --chown=9999:9999 /home/luser/target/x86_64-unknown-linux-musl/release/intrasys /usr/local/bin/intrasys
|
||||||
|
USER 9999
|
||||||
|
ENTRYPOINT ["/usr/local/bin/intrasys"]
|
||||||
|
ENV INTRASYS_HOST="0.0.0.0"
|
||||||
|
EXPOSE 8080/tcp
|
@@ -1,7 +1,7 @@
|
|||||||
-- Create accounts table
|
-- Create accounts table
|
||||||
CREATE TABLE accounts (
|
CREATE TABLE accounts (
|
||||||
account_id BIGINT PRIMARY KEY,
|
account_id BIGINT PRIMARY KEY,
|
||||||
balance DECIMAL(20, 10) NOT NULL
|
balance DECIMAL(20, 2) NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Create transactions table for audit purposes
|
-- Create transactions table for audit purposes
|
||||||
@@ -9,7 +9,7 @@ CREATE TABLE transactions (
|
|||||||
transaction_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
transaction_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
source_account_id BIGINT NOT NULL,
|
source_account_id BIGINT NOT NULL,
|
||||||
destination_account_id BIGINT NOT NULL,
|
destination_account_id BIGINT NOT NULL,
|
||||||
amount DECIMAL(20, 10) NOT NULL,
|
amount DECIMAL(20, 2) NOT NULL,
|
||||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
||||||
FOREIGN KEY (source_account_id) REFERENCES accounts (account_id),
|
FOREIGN KEY (source_account_id) REFERENCES accounts (account_id),
|
||||||
FOREIGN KEY (destination_account_id) REFERENCES accounts (account_id)
|
FOREIGN KEY (destination_account_id) REFERENCES accounts (account_id)
|
||||||
|
Reference in New Issue
Block a user