mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-23 04:26:57 +00:00
dockerfile and compose added
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
|||||||
|
ARG ELIXIR="1.16.2"
|
||||||
|
ARG ERLANG="26.0.2"
|
||||||
|
ARG DEBIAN_VERSION="buster-20240513-slim"
|
||||||
|
|
||||||
|
# Step 1: Build release
|
||||||
|
FROM hexpm/elixir:${ELIXIR}-erlang-${ERLANG}-debian-${DEBIAN_VERSION} AS build
|
||||||
|
|
||||||
|
WORKDIR /plantid_discord_bot
|
||||||
|
|
||||||
|
RUN MIX_ENV=prod
|
||||||
|
|
||||||
|
RUN mix local.hex --force && \
|
||||||
|
mix local.rebar --force
|
||||||
|
|
||||||
|
COPY mix.exs mix.lock ./
|
||||||
|
COPY config config
|
||||||
|
COPY lib lib
|
||||||
|
|
||||||
|
RUN mix deps.get --only prod
|
||||||
|
RUN MIX_ENV=prod mix release
|
||||||
|
|
||||||
|
# Step 2: Create app image
|
||||||
|
FROM debian:${DEBIAN_VERSION}
|
||||||
|
|
||||||
|
WORKDIR /plantid_discord_bot
|
||||||
|
|
||||||
|
RUN apt-get update -y && apt-get install -y openssl locales
|
||||||
|
|
||||||
|
COPY \
|
||||||
|
--from=build \
|
||||||
|
--chown=nobody:root \
|
||||||
|
/plantid_discord_bot/_build/prod/rel/plantid_discord_bot ./
|
||||||
|
|
||||||
|
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
|
||||||
|
ENV LANG="en_US.UTF-8"
|
||||||
|
ENV LANGUAGE="en_US:en"
|
||||||
|
ENV LC_ALL="en_US.UTF-8"
|
||||||
|
|
||||||
|
EXPOSE 4321
|
||||||
|
|
||||||
|
CMD ["/plantid_discord_bot/bin/plantid_discord_bot", "start"]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: plantid_discord_bot
|
||||||
|
environment:
|
||||||
|
- MIX_ENV=prod
|
||||||
|
- PLANTNET_API_KEY=${PLANTNET_API_KEY}
|
||||||
|
- DISCORD_TOKEN=${DISCORD_TOKEN}
|
||||||
|
- LOGS_DISCORD_WEBHOOK_URL=${LOGS_DISCORD_WEBHOOK_URL}
|
||||||
|
ports:
|
||||||
|
- "4321:4321"
|
||||||
|
volumes:
|
||||||
|
- appdata:/plantid_discord_bot
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
appdata:
|
||||||
Reference in New Issue
Block a user