Skip to content

Commit

Permalink
mod: development build variant
Browse files Browse the repository at this point in the history
  • Loading branch information
bennjii committed Nov 19, 2023
1 parent 9b8554a commit c3751be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ RUN rm src/*.rs
COPY ./src ./src
COPY ./Rocket.toml ./

# build for release
# RUN rm ./target/release/deps/stock* .
RUN ROCKET_ENV=prod cargo build --release --locked
# build for release or dev depending on what is desired
RUN if [ ${RELEASE_TYPE} = "dev" ]; then cargo build --locked ; else ROCKET_ENV=prod cargo build --release --locked ; fi

# move that file up the tree
RUN if [ ${RELEASE_TYPE} = "dev" ]; then cp /open-stock/target/debug/open-stock . ; else cp /open-stock/target/release/open-stock . ; fi

# our final base
FROM rust:1.70.0

# copy the build artifact from the build stage
COPY --from=build /open-stock/target/release/open-stock .
COPY --from=build /open-stock .
COPY --from=build /open-stock/Rocket.toml .

ARG PORT=8080
Expand Down
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Builds for development (Production builds should be done by CI)
docker build . -t bennjii/open-stock --build-arg RELEASE_TYPE=dev

0 comments on commit c3751be

Please sign in to comment.