Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
create docker/railway and docker/render dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Sep 20, 2022
1 parent d3bb8ad commit 1924cc5
Show file tree
Hide file tree
Showing 50 changed files with 679 additions and 161 deletions.
21 changes: 2 additions & 19 deletions cmd/app/docker-init.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package app

import (
"log"
"path/filepath"

"github.com/abdfnx/botway/constants"
"github.com/abdfnx/botway/internal/pipes/initx"
"github.com/abdfnx/botway/tools"
"github.com/abdfnx/tran/dfs"
"github.com/spf13/cobra"
)

Expand All @@ -16,21 +10,10 @@ func DockerInitCMD() *cobra.Command {
Use: "docker-init",
Short: "Initialize ~/.botway for docker containers",
Run: func(cmd *cobra.Command, args []string) {
if opts.CopyFile {
err := dfs.CreateDirectory(filepath.Join(constants.HomeDir, ".botway"))

if err != nil {
log.Fatal(err)
}

tools.Copy("botway.json", constants.BotwayConfigFile)
} else {
initx.DockerInit()
}
initx.SetupTokensInDocker()
initx.DockerInit()
},
}

cmd.Flags().BoolVarP(&opts.CopyFile, "copy-file", "", false, "Copy config file")

return cmd
}
1 change: 0 additions & 1 deletion cmd/app/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
)

var opts = options.InitOptions{
CopyFile: false,
NoRepo: false,
}

Expand Down
27 changes: 27 additions & 0 deletions dockerfiles/railway/blank.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM scratch

COPY . .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

### Replace `scratch` with the linux distribution you want to use ###
### Example: FROM alpine:latest ###
### Or with with the bot language with the tag: ###
### Example: FROM ruby:alpine ###

### Add here the packages you want to use ###
### Example: ENV PACKAGES "Packages to add" ###
### RUN apk update && apk add --no-cache --virtual ${PACKAGES} ###

### Copy here all the files you want to use ###
### Example: COPY . . ###

### Add here the build command to build your bot ###
### Example: RUN cargo build --release ###

### Last step: Add here the entrypoint command to run your bot ###
### Example: ENTRYPOINT ["python3", "./src/main.py"] ###
15 changes: 15 additions & 0 deletions dockerfiles/railway/bun.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM jarredsumner/bun:edge

COPY . .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

ENV PATH="/root/.bun/bin:$PATH"

RUN bun i

ENTRYPOINT [ "bun", "src/main.js" ]
16 changes: 16 additions & 0 deletions dockerfiles/railway/c-discord.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM botwayorg/concord

COPY . .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

# To add more packages
# RUN apk add PACKAGE_NAME

RUN gcc src/main.c -o bot -pthread -ldiscord -lcurl

ENTRYPOINT [ "./bot" ]
21 changes: 21 additions & 0 deletions dockerfiles/railway/cargo.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM rust:alpine

COPY . .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

ENV PACKAGES "build-dependencies build-base openssl openssl-dev musl-dev libressl-dev gcc git lld clang libsodium ffmpeg opus autoconf automake libtool m4 youtube-dl binutils zlib-dev boost boost-dev"

RUN apk update && \
apk add --no-cache --virtual ${PACKAGES}

# To add more packages
# RUN apk add PACKAGE_NAME

RUN cargo build --release --bin bot

ENTRYPOINT ["./target/release/bot"]
20 changes: 20 additions & 0 deletions dockerfiles/railway/cmake-discord.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM brainboxdotcc/dpp:latest

COPY .botway.yaml .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

WORKDIR /usr/src/{{.BotName}}

COPY . .

WORKDIR /usr/src/{{.BotName}}/build

RUN cmake ..
RUN make -j$(nproc)

ENTRYPOINT [ "/usr/src/{{.BotName}}/build/{{.BotName}}" ]
29 changes: 29 additions & 0 deletions dockerfiles/railway/cmake-telegram.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM reo7sp/tgbot-cpp:latest

COPY .botway.yaml .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

RUN apt-get update -y && \
apt-get install -y libopus-dev opus-tools git gcc cmake make libffi-dev python-dev ffmpeg build-essential autoconf automake libtool m4 youtube-dl

RUN git clone https://github.com/nlohmann/json && \
cd json && \
cmake . && \
make -j && \
make install

WORKDIR /usr/src/{{.BotName}}

COPY . .

WORKDIR /usr/src/{{.BotName}}/build

RUN cmake ..
RUN make -j$(nproc)

ENTRYPOINT [ "/usr/src/{{.BotName}}/build/{{.BotName}}" ]
22 changes: 22 additions & 0 deletions dockerfiles/railway/crystal.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM crystallang/crystal:nightly-alpine

COPY . .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

ENV PACKAGES "build-dependencies build-base gcc git libsodium opus ffmpeg binutils openssl-dev zlib-dev boost boost-dev"

RUN apk update && \
apk add --no-cache --virtual ${PACKAGES}

# To add more packages
# RUN apk add PACKAGE_NAME

RUN shards install
RUN shards build --static --no-debug --release --production -v

ENTRYPOINT [ "./bin/{{.BotName}}" ]
43 changes: 43 additions & 0 deletions dockerfiles/railway/csharp.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM scratch AS bw

COPY .botway.yaml .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build

WORKDIR /source

COPY *.csproj .

RUN dotnet restore -r linux-musl-x64

COPY . .

RUN dotnet publish -c release -o /app -r linux-musl-x64 --self-contained false --no-restore

FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine-amd64

ENV \
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
PACKAGES="build-dependencies build-base gcc git libsodium opus ffmpeg icu-libs binutils openssl-dev zlib-dev boost boost-dev"

RUN apk update && \
apk add --no-cache --virtual ${PACKAGES}

# To add more packages
# RUN apk add PACKAGE_NAME

COPY --from=build /app /app

COPY --from=bw /root/.botway /root/.botway

COPY . .

ENTRYPOINT ["./app/{{.BotName}}"]
15 changes: 15 additions & 0 deletions dockerfiles/railway/dart.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM dart:stable

COPY . .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

RUN dart pub get

RUN dart compile exe src/main.dart -o bot

ENTRYPOINT ["./bot"]
21 changes: 21 additions & 0 deletions dockerfiles/railway/deno.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM denoland/deno:alpine

COPY . .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

ENV PACKAGES "build-dependencies build-base gcc git ffmpeg curl binutils openssl-dev zlib-dev boost boost-dev"

RUN apk update && \
apk add --no-cache --virtual ${PACKAGES}

# To add more packages
# RUN apk add PACKAGE_NAME

RUN deno cache deps.ts

ENTRYPOINT ["deno", "run", "--allow-all", "main.ts"]
18 changes: 18 additions & 0 deletions dockerfiles/railway/fleet.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM botwayorg/fleet-rs:latest

COPY . .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

RUN apk update

# To add more packages
# RUN apk add PACKAGE_NAME

RUN fleet build --release --bin bot

ENTRYPOINT ["./target/release/bot"]
26 changes: 26 additions & 0 deletions dockerfiles/railway/go.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM golang:alpine

COPY .botway.yaml .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

ENV PACKAGES "build-dependencies build-base gcc git binutils openssl-dev zlib-dev boost boost-dev"

RUN apk update && \
apk add --no-cache --virtual ${PACKAGES}

# To add more packages
# RUN apk add PACKAGE_NAME

WORKDIR /app/

COPY . .

RUN go mod tidy
RUN go build -o bot ./src/main.go

ENTRYPOINT ["./bot"]
25 changes: 25 additions & 0 deletions dockerfiles/railway/gradle.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM gradle:alpine

COPY . .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

ENV PACKAGES "build-dependencies build-base openssl openssl-dev musl-dev libressl-dev gcc git libsodium opus ffmpeg m4 binutils zlib-dev boost boost-dev"

RUN apk update && \
apk add --no-cache --virtual ${PACKAGES}

# To add more packages
# RUN apk add PACKAGE_NAME

RUN gradle wrapper

RUN gradle build --no-daemon

RUN ./gradlew

ENTRYPOINT [ "./gradlew", "run" ]
23 changes: 23 additions & 0 deletions dockerfiles/railway/nim.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM nimlang/nim:alpine

COPY . .

ENV BOTWAY-DIR /root/.botway

RUN mkdir ${BOTWAY-DIR}

COPY botway.json ${BOTWAY-DIR}

ENV PACKAGES "build-dependencies build-base openssl openssl-dev musl-dev libressl-dev gcc git lld clang libsodium ffmpeg opus autoconf automake libtool m4 youtube-dl binutils zlib-dev boost boost-dev"

RUN apk update && \
apk add --no-cache --virtual ${PACKAGES}

# To add more packages
# RUN apk add PACKAGE_NAME

RUN nimble install -y

RUN nim c -d:ssl ./src/main.nim

ENTRYPOINT [ "./src/main" ]
Loading

0 comments on commit 1924cc5

Please sign in to comment.