Added Docker Support

This commit is contained in:
Alec Höfler 2021-03-23 21:33:11 +02:00
parent ae90621b5d
commit 2325fb917c
3 changed files with 38 additions and 0 deletions

32
Dockerfile Normal file
View file

@ -0,0 +1,32 @@
FROM golang:alpine AS builder
# Set necessary environmet variables needed for our image
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
# Move to working directory /build
WORKDIR /build
# Copy and download dependency using go mod
COPY go.mod .
RUN go mod download
# Copy the code into the container
COPY . .
# Run test
RUN go test ./...
# Build the application
RUN go build main.go
# Move to /dist directory as the place for resulting binary folder
WORKDIR /dist
# Copy binary from build to main folder
RUN cp /build/main .
RUN cp /build/config.json .
CMD ["/dist/main","-t","USER-TOKEN"]

5
docker-compose.yml Normal file
View file

@ -0,0 +1,5 @@
#This file is used for testing the server. Use this only if you want to contribute. If you want to try new Features already uploaded check the registry. every branch will be build automatic when new code is pushed.
version: '2.1'
services:
bot:
build: .

1
go.mod Normal file
View file

@ -0,0 +1 @@
require github.com/bwmarrin/discordgo v0.23.1