Skip to content

Commit

Permalink
Use debian docker image (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
macifell authored Feb 6, 2024
1 parent cc85608 commit a0385ef
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 24.0.5
erlang 24.2.2
elixir 1.13.1-otp-24
34 changes: 19 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
FROM elixir:1.13.1-slim AS builder

FROM elixir:1.13-alpine AS builder

RUN apk add --no-cache git openssh-client
# Install dependencies
RUN set -xe; \
apt-get update && apt-get install -y \
build-essential \
ca-certificates \
git \
openssh-client;

WORKDIR /tmp/beebee

Expand All @@ -20,7 +25,7 @@ COPY rel ./rel

RUN MIX_ENV=prod mix release

FROM alpine:3.16
FROM debian:11.6-slim

# These are fed in from the build script
ARG VCS_REF
Expand All @@ -31,28 +36,27 @@ LABEL \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.description="URL shortener for http://s76.co" \
org.opencontainers.image.revision="${VCS_REF}" \
org.opencontainers.image.source="https://github.com/pop-os/warehouse" \
org.opencontainers.image.source="https://github.com/system76/beebee" \
org.opencontainers.image.title="beebee" \
org.opencontainers.image.vendor="system76" \
org.opencontainers.image.version="${VERSION}"

RUN apk update && \
apk add --no-cache \
git \
bash \
libgcc \
libstdc++ \
ca-certificates \
ncurses-libs \
openssl
RUN set -xe; \
apt-get update && apt-get install -y \
ca-certificates \
libmcrypt4 \
openssl;

RUN addgroup -S beebee && adduser -S beebee -G beebee
RUN set -xe; \
adduser --uid 1000 --system --home /beebee --shell /bin/sh --group beebee;

COPY --from=builder /tmp/beebee/_build/prod/rel/beebee ./

RUN chown -R beebee:beebee bin/beebee releases/
RUN chown -R beebee:beebee `ls | grep 'erts-'`/

ENV LANG=C.UTF-8

USER beebee

EXPOSE 4000
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BeeBee requires Elixir >= 1.10 and Redis >= 3.0.

## Usage

BeeBee exposes two API endpoints, `POST /_add` and `GET /_stats`.
BeeBee exposes four API endpoints, `POST /_add`, `PUT /_update`, `DELETE /_delete/:short_tag` and `GET /_stats`.

### `POST /_add`

Expand Down
16 changes: 16 additions & 0 deletions api.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
POST /_add HTTP/1.1
Host: localhost:4002
Authorization: Basic dXNlcjpwYXNzd29yZA==
Content-Type: application/json
Content-Length: 58

{
"url": "https://github.com",
"short_tag": "github"
}

###

GET /_stats HTTP/1.1
Host: localhost:4002
Authorization: Basic dXNlcjpwYXNzd29yZA==

0 comments on commit a0385ef

Please sign in to comment.