Skip to content

Commit

Permalink
Use alpine as base for Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
midzelis committed Jun 1, 2023
1 parent f499ae8 commit 86ca33f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
FROM lukemathwalker/cargo-chef:latest-rust-1.68.0 AS chef
FROM rust:alpine as chef
RUN apk add --no-cache musl-dev file make
RUN cargo install cargo-chef
WORKDIR app

FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder

# Ensure working C compile setup (not installed by default in arm64 images)
RUN apt update && apt install build-essential -y

COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json

COPY . .
RUN cargo build --release --bin atuin

FROM debian:bullseye-20230502-slim AS runtime

RUN useradd -c 'atuin user' atuin && mkdir /config && chown atuin:atuin /config
RUN apt update && apt install ca-certificates -y # so that webhooks work
WORKDIR app
FROM alpine:3.12 as runner
RUN apk add shadow ca-certificates
RUN groupmod -g 1000 users \
&& useradd -u 1000 -m atuin \
&& usermod -G users atuin \
&& mkdir /config \
&& chown atuin:users /config

USER atuin

Expand All @@ -29,4 +28,5 @@ ENV RUST_LOG=atuin::api=info
ENV ATUIN_CONFIG_DIR=/config

COPY --from=builder /app/target/release/atuin /usr/local/bin
ENTRYPOINT ["/usr/local/bin/atuin"]
CMD ["/usr/local/bin/atuin"]

8 changes: 5 additions & 3 deletions docs/docs/self-hosting/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ Create a `docker-compose.yml`:
version: '3.5'
services:
atuin:
restart: always
image: ghcr.io/ellie/atuin:main
restart: always
user: ${UID:-1000}:${GID:-1000}
command: server start
volumes:
- "./config:/config"
Expand All @@ -38,8 +39,9 @@ services:
ATUIN_OPEN_REGISTRATION: "true"
ATUIN_DB_URI: postgres://$ATUIN_DB_USERNAME:$ATUIN_DB_PASSWORD@db/atuin
postgresql:
image: postgres:14
restart: unless-stopped
image: postgres:14-alpine
restart: always
user: ${UID:-1000}:${GID:-1000}
volumes: # Don't remove permanent storage for index database files!
- "./database:/var/lib/postgresql/data/"
environment:
Expand Down

0 comments on commit 86ca33f

Please sign in to comment.