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

Fix missing lib issue in docker image build #15

Merged
merged 1 commit into from
Nov 21, 2023
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
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
Loading