Skip to content

Commit b32732c

Browse files
authored
Add Dockerfile (#29)
* Add Dockerfile
1 parent 9bfeffb commit b32732c

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
target*
2+
docs
3+
web
4+
.github
5+
.ropeproject

Dockerfile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM ubuntu:latest AS builder
2+
3+
RUN apt update && \
4+
apt install -y build-essential cmake clang curl
5+
6+
# Install Rust.
7+
# We are not using rust:1 because
8+
# bindgen is producing weird pointer types there.
9+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
10+
11+
COPY . /build
12+
WORKDIR /build
13+
14+
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
15+
RUN source ~/.cargo/env && \
16+
cargo build --release
17+
18+
FROM ubuntu:latest
19+
ENV RUST_LOG=info
20+
RUN apt update && \
21+
apt install -y ca-certificates && \
22+
update-ca-certificates
23+
24+
COPY --from=builder /build/target/release/pgdog /pgdog/pgdog
25+
COPY pgdog.toml /pgdog/pgdog.toml
26+
COPY users.toml /pgdog/users.toml
27+
28+
WORKDIR /pgdog
29+
CMD ["/pgdog/pgdog"]

pgdog/src/net/stream.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ use bytes::{BufMut, BytesMut};
44
use pin_project::pin_project;
55
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, BufStream, ReadBuf};
66
use tokio::net::TcpStream;
7-
use tracing::{error, trace};
7+
use tracing::trace;
88

99
use std::io::Error;
1010
use std::net::SocketAddr;
1111
use std::ops::Deref;
1212
use std::pin::Pin;
1313
use std::task::Context;
1414

15-
use super::messages::{ErrorResponse, FromBytes, Message, Protocol, ReadyForQuery, Terminate};
15+
use super::messages::{ErrorResponse, Message, Protocol, ReadyForQuery, Terminate};
1616

1717
/// A network socket.
1818
#[pin_project(project = StreamProjection)]
@@ -110,6 +110,9 @@ impl Stream {
110110

111111
#[cfg(debug_assertions)]
112112
{
113+
use crate::net::messages::FromBytes;
114+
use tracing::error;
115+
113116
if message.code() == 'E' {
114117
let error = ErrorResponse::from_bytes(bytes.clone())?;
115118
error!("{:?} <= {}", self.peer_addr(), error)

0 commit comments

Comments
 (0)