Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 102 additions & 28 deletions backend/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "backend"
version = "0.1.0"
edition = "2024"
edition = "2021"

[dependencies]
tokio = { version = "1", features = ["full"] }
Expand All @@ -17,3 +17,7 @@ serde_json = "1.0.142"
[dev-dependencies]
tokio = { version = "1", features = ["full"] }
rand = "0.8"

[[bin]]
name = "backend"
path = "src/main.rs"
28 changes: 28 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 1. ビルドステージ
FROM rust:1.84 as builder
WORKDIR /usr/src/app

COPY ./Cargo.toml ./Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release
RUN rm -rf src

COPY . ./backend
WORKDIR /usr/src/app/backend
RUN cargo build --release

# 2. 実行ステージ
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# バイナリコピー
COPY --from=builder /usr/src/app/backend/target/release/backend /app/backend

# データコピー
COPY ./data /app/data

ENV PORT=3000
EXPOSE 3000
CMD ["/app/backend"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions backend/fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# fly.toml app configuration file generated for atcoder-random-picker-be on 2025-08-18T01:08:21+09:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'atcoder-random-picker-be'
primary_region = 'nrt'

[build]

[env]
PORT = '3000'

[http_service]
internal_port = 3000
force_https = true
protocol = "tcp"
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ['app']

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
Loading