Skip to content

Commit

Permalink
Fix missing lib issue in docker image build
Browse files Browse the repository at this point in the history
  • Loading branch information
rashed091 committed Nov 21, 2023
1 parent bb54a67 commit 3dff556
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "rust-service-template"
name = "rustful"
version = "0.1.0"
edition = "2021"

Expand Down
16 changes: 13 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Create a stage for building the application.
ARG RUST_VERSION=1.73.0
ARG APP_NAME="rust-service-template"
FROM rust:${RUST_VERSION}-slim-bullseye AS build
# version can be latest or specific like 1.73.0
ARG RUST_VERSION=latest
ARG APP_NAME="rustful"

FROM rust:${RUST_VERSION} AS builder

ARG APP_NAME

WORKDIR /app

# Install diesel CLI for migration
RUN cargo install diesel_cli --no-default-features --features postgres

# Build the application.
# Leverage a cache mount to ~/.cargo/registry
# for downloaded dependencies and a cache mount to /app/target/ for
Expand Down Expand Up @@ -43,11 +50,14 @@ RUN adduser \
appuser
USER appuser

RUN apt update && apt install -y openssl libpq-dev pkg-config

# Copy the executable from the "build" stage.
COPY --from=build /bin/server /bin/

# Expose the port that the application listens on.
EXPOSE 5001

# What the container should run when it is started.
# CMD ["bash", "-c", "./author diesel migration run && ./author"]
CMD ["/bin/server"]
2 changes: 0 additions & 2 deletions src/common/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use diesel::r2d2::{self, ConnectionManager, PooledConnection};
use once_cell::sync::OnceCell;

pub type DbCon = diesel::PgConnection;
pub type DieselBackend = diesel::pg::Pg;

pub type Pool = r2d2::Pool<ConnectionManager<DbCon>>;
pub type Connection = PooledConnection<ConnectionManager<DbCon>>;

Expand Down

0 comments on commit 3dff556

Please sign in to comment.