Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile #81

Merged
merged 3 commits into from
Aug 2, 2024
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
3 changes: 3 additions & 0 deletions Rocket2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[global]
address = "0.0.0.0"
port = 8001
41 changes: 31 additions & 10 deletions token-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
FROM rust:1.77.0
# Use a base image that has the required GLIBC version
FROM debian:bullseye-slim as builder

# Set working directory
WORKDIR /app/lib
COPY ../lib .
# Install Rust, protobuf compiler, and library dependencies
RUN apt-get update && apt-get install -y curl build-essential protobuf-compiler libprotobuf-dev pkg-config libssl-dev
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Copy the project code
WORKDIR /app
COPY . .
# Set the environment path for Rust
ENV PATH="/root/.cargo/bin:${PATH}"

RUN cargo build --release
EXPOSE 8001
# Run the application
# Create a working directory
WORKDIR /mercurylayer

RUN echo "[workspace]\nmembers = [\"token-server\", \"lib\"]" > ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock

# Copy the server source code
COPY ./token-server ./token-server
COPY ./lib ./lib
COPY ./Rocket2.toml ./token-server/Rocket.toml

# Make sure to copy Cargo.lock
COPY ./token-server/Cargo.lock ./token-server/Cargo.lock

WORKDIR /mercurylayer/token-server

# RUN cargo build --verbose

# # Build your Rust project. Since the source files are now present,
# # the Rust compiler should be able to find and compile them.
RUN CARGO_TARGET_DIR=target cargo build --release

# # Command to run the server by default when the container starts
CMD ["cargo", "run", "--bin", "token-server"]

Loading