Skip to content

Commit

Permalink
finilize dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
karambarakat committed Oct 18, 2023
1 parent 663004f commit e377474
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 32 deletions.
17 changes: 7 additions & 10 deletions apps/rust/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ FROM rust:latest as base

WORKDIR /usr/src/backend

RUN rustup target add x86_64-unknown-linux-musl
RUN apt update && apt install -y musl-tools musl-dev
RUN update-ca-certificates

COPY . .

RUN find . -type f -name "Cargo.toml" -print0 | xargs --null -I {} echo {} > cargo.log
Expand Down Expand Up @@ -35,14 +31,11 @@ RUN cat rs.log | xargs rm

COPY . .

RUN cargo build --bin backend --release --target x86_64-unknown-linux-musl
RUN cargo build --bin backend

FROM alpine
FROM ubuntu

WORKDIR /usr/dist
COPY --from=install usr/src/backend/target/x86_64-unknown-linux-musl/release .

EXPOSE 8080

RUN adduser \
--disabled-password \
Expand All @@ -55,4 +48,8 @@ RUN adduser \

USER be:be

CMD ["usr/dist/backend"]
COPY --from=install usr/src/backend/target/debug .

EXPOSE 8080

CMD ["/usr/dist/backend"]
6 changes: 4 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ services:
build:
context: .
dockerfile: apps/rust/Dockerfile
# run sleep infinity on start
command: ['sleep', 'infinity']
# command: ['/usr/dist/backend']
ports:
- 8080:8080
environment:
PORT: 8080
JWT_SALT: random
SALT: random
FE_URL: http://localhost:5173
DATABASE_URL: postgres://postgres:postgres@localhost:5431/postgres
DATABASE_URL: postgres://postgres:postgres@db:5431/postgres
networks:
- network
depends_on:
Expand Down
60 changes: 42 additions & 18 deletions do_app_spec.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,47 @@
alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
databases:
- engine: PG
name: db
version: "12"
features:
- buildpack-stack=ubuntu-22
ingress:
rules:
- component:
name: moneytracker
match:
path:
prefix: /
name: sea-turtle-app
- component:
name: moneytracker
match:
path:
prefix: /
name: plankton-app
region: sfo
services:
- dockerfile_path: Dockerfile
github:
branch: master
deploy_on_push: true
repo: karam-dev/MoneyTracker
http_port: 8080
instance_count: 1
instance_size_slug: basic-xs
name: moneytracker
source_dir: /
- environment_slug: node-js
envs:
- key: DATABASE_URL
scope: RUN_AND_BUILD_TIME
value: ${db.DATABASE_URL}
- key: JWT_SALT
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:e/Lbi4p3D4nga2b5Fhy/BuzNY/B9dzHJ:Bp04PbhCr0dEgg/SdX5CKRlcCtOjVQ==]
- key: SALT
scope: RUN_AND_BUILD_TIME
type: SECRET
value: EV[1:kwG/LSezpusG9V5fOyr68hDiyJnPRQK+:B7IlyYxa5kzj7guUBhLgWA2j3v1gwA==]
- key: FE_URL
scope: RUN_AND_BUILD_TIME
value: tracker.karam.page
- key: PORT
scope: RUN_AND_BUILD_TIME
value: "8080"
github:
branch: prod
deploy_on_push: true
repo: karambarakat/MoneyTracker
http_port: 8080
instance_count: 1
instance_size_slug: basic-xs
name: moneytracker
source_dir: /
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"prepare": "husky install",
"dev": "cross-env RUST_ENV=dev cargo run & pnpm -F ui -F frontend --parallel dev",
"// manual deployment": "",
"do-deploy:get": "doctl apps spec get f898aa0c-2753-4936-89a1-4d2ee45d2869 > do_app_spec.local.yaml",
"do-deploy:upload": "doctl apps update f898aa0c-2753-4936-89a1-4d2ee45d2869 --spec do_app_spec.yaml"
"do-deploy:get": "doctl apps spec get 534d04f5-74df-4f8d-a5fd-de38c2c06790 > do_app_spec.yaml",
"do-deploy:upload": "doctl apps update 534d04f5-74df-4f8d-a5fd-de38c2c06790 --spec do_app_spec.yaml"
},
"devDependencies": {
"@playwright/test": "^1.34.3",
Expand Down

0 comments on commit e377474

Please sign in to comment.