Skip to content

Commit

Permalink
chore: backport auth2 docker stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Fleeym committed Nov 11, 2024
1 parent 1fb2ed2 commit ebef5fc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 38 deletions.
46 changes: 24 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
FROM rust:1-alpine3.19 as chef
ENV RUSTFLAGS="-C target-feature=-crt-static"
RUN apk update
RUN apk add --no-cache pkgconfig openssl openssl-dev musl-dev
RUN cargo install cargo-chef
WORKDIR /app
FROM ubuntu:22.04

RUN apt-get -qq update

RUN apt-get install -y -q \
git curl ca-certificates build-essential \
libssl-dev pkg-config software-properties-common

# install rustup and add to path
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

RUN cargo install sqlx-cli
RUN cargo install cargo-watch
RUN rustup component add clippy
RUN rustup component add rust-analyzer

# install neovim and other dev stuff
RUN apt-add-repository ppa:neovim-ppa/unstable
RUN apt-get update
RUN apt-get install -y -q neovim fzf \
postgresql-client ripgrep

FROM chef as planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
ENV TERM xterm-256color

FROM chef as builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release
RUN strip target/release/geode-index
RUN git config --global --add safe.directory /app

FROM alpine:3.19
WORKDIR /app
COPY --from=builder /app/target/release/geode-index /app/target/release/geode-index
COPY . .
RUN apk add --no-cache libgcc
RUN chmod +x /app/target/release/geode-index
EXPOSE 3000
ENTRYPOINT [ "/app/target/release/geode-index" ]
25 changes: 9 additions & 16 deletions docker-compose.yml → compose.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
version: "3.8"
name: "geode-index"
services:
app:
build:
context: ./
dockerfile: Dockerfile-dev
dockerfile: Dockerfile
container_name: geode-index
restart: unless-stopped
environment:
- DATABASE_URL=postgres://geode:geode@geode-postgres/geode
develop:
watch:
- action: rebuild
path: ./src
target: /app
ignore:
- "target"
stdin_open: true
tty: true
depends_on:
- postgres
env_file:
- ./.env
networks:
- dev
ports:
- "3000:3000"
- "${PORT:-3000}:${PORT:-3000}"
volumes:
- ./:/app
- "${HOME}/.config/nvim:/root/.config/nvim"
postgres:
container_name: geode-postgres
image: postgres:14.10-alpine3.19
image: postgres:14-alpine3.20
restart: unless-stopped
environment:
- POSTGRES_PASSWORD=geode
Expand All @@ -42,4 +35,4 @@ volumes:
postgres-db:
networks:
dev:
driver: bridge
driver: bridge

0 comments on commit ebef5fc

Please sign in to comment.