Merge pull request #4 from bensherriff/develop
Fixed docker container linking
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
DISCORD_TOKEN=
|
||||
RUST_LOG=warn,siren=info
|
||||
POSTGRES_USER=
|
||||
POSTGRES_USER=siren
|
||||
POSTGRES_PASSWORD=
|
||||
POSTGRES_DB=
|
||||
POSTGRES_DB=siren
|
||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1372,7 +1372,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "siren"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"dotenv",
|
||||
"env_logger",
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
[package]
|
||||
name = "siren"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dotenv = "0.15.0"
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -9,12 +9,12 @@ WORKDIR /packages
|
||||
RUN apt-get update && apt-get install -y curl tar xz-utils
|
||||
RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux > yt-dlp && \
|
||||
chmod +x yt-dlp
|
||||
RUN curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/latest/download/ffmpeg-master-latest-linux64-gpl.tar.xz > ffmpeg.tar.xz && \
|
||||
RUN curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz > ffmpeg.tar.xz && \
|
||||
tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz
|
||||
|
||||
FROM debian:bullseye-slim as runtime
|
||||
WORKDIR /siren
|
||||
RUN apt-get update && apt-get install -y libopus-dev ffmpeg youtube-dl
|
||||
COPY --from=builder /siren/target/release/siren siren
|
||||
COPY --from=builder /siren/target/release/siren /usr/local/bin/siren
|
||||
COPY --from=packages /packages /usr/bin
|
||||
CMD ["./siren"]
|
||||
CMD ["siren"]
|
||||
|
||||
26
Makefile
26
Makefile
@@ -1,32 +1,26 @@
|
||||
#!make
|
||||
SHELL := /bin/bash
|
||||
include .version
|
||||
include .env
|
||||
include .version
|
||||
export $(shell sed 's/=.*//' .env)
|
||||
export $(shell sed 's/=.*//' .version)
|
||||
|
||||
.PHONY: help build test up down exec clean
|
||||
|
||||
build:
|
||||
# if docker inspect siren > /dev/null 2>&1; then docker rmi siren; fi; docker-compose build
|
||||
docker build -t siren .
|
||||
docker build -t siren:${SIREN_VERSION} .
|
||||
|
||||
test:
|
||||
# docker run --rm -it siren:latest bash
|
||||
docker run --env-file .env -it --rm --name siren siren:latest
|
||||
docker run --env-file .env -it --rm --name siren siren:${SIREN_VERSION}
|
||||
|
||||
up:
|
||||
if [[ ! $$(docker images -q siren 2> /dev/null) ]]; then docker-compose build; fi; \
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
|
||||
down:
|
||||
docker-compose down
|
||||
docker compose down
|
||||
|
||||
exec:
|
||||
docker exec -it siren bash
|
||||
|
||||
clean:
|
||||
docker rmi siren
|
||||
|
||||
deploy:
|
||||
@echo "Deploying application..."
|
||||
@mvn clean deploy || { \
|
||||
echo "Deployment failed!"; \
|
||||
exit 1; \
|
||||
}
|
||||
@echo "Deployment successful!"
|
||||
|
||||
@@ -21,8 +21,8 @@ https://discord.com/api/oauth2/authorize?client_id=<CLIENT_ID>&permissions=40671
|
||||
- The CLIENT_ID can be found in the General Information tab on the Discord Developer Portal for your application, under `Application ID`
|
||||
|
||||
1. Copy `.env.TEMPLATE` to `.env` and fill out the fields
|
||||
2. Start the application with `docker compose up -d`
|
||||
- Requires [Docker](https://www.docker.com/)
|
||||
2. Build the [Docker](https://www.docker.com/) application with `make build`
|
||||
3. Start the application with `make up`
|
||||
|
||||
## Contributing
|
||||
[Rust](https://www.rust-lang.org/) must be installed to run locally. See [serenity-rs/serenity](https://github.com/serenity-rs/serenity) for more information about Rust Discord API Library.
|
||||
@@ -40,6 +40,6 @@ Begin the application with `cargo run`
|
||||
|
||||
The application can also be tested from within a Docker container:
|
||||
```
|
||||
docker build -t siren .
|
||||
docker build -t siren:latest .
|
||||
docker run --env-file .env -it --rm --name siren siren:latest
|
||||
```
|
||||
@@ -2,31 +2,30 @@ version: '3'
|
||||
|
||||
services:
|
||||
siren:
|
||||
image: siren
|
||||
image: siren:${SIREN_VERSION}
|
||||
container_name: siren
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./Dockerfile
|
||||
args:
|
||||
- VERSION=${SIREN_VERSION}
|
||||
volumes:
|
||||
- ./app:/usr/src/siren
|
||||
#volumes:
|
||||
# - ./app:/siren
|
||||
environment:
|
||||
DISCORD_TOKEN: ${DISCORD_TOKEN}
|
||||
DATABASE_URL: jdbc:postgresql://db:5432/${POSTGRES_DB}
|
||||
DATABASE_USERNAME: ${POSTGRES_USER}
|
||||
DATABASE_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db/${POSTGRES_DB}
|
||||
depends_on:
|
||||
- db
|
||||
restart: unless-stopped
|
||||
db:
|
||||
image: postgres:latest
|
||||
container_name: siren_db
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
volumes:
|
||||
- ./data:/var/lib/postgresql/data
|
||||
#volumes:
|
||||
# - ./data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
restart: unless-stopped
|
||||
restart: unless-stopped
|
||||
|
||||
Reference in New Issue
Block a user