From 204850a67ba38f3d2bdaabec77b7a619f1ab7324 Mon Sep 17 00:00:00 2001 From: Heorhi Valakhanovich Date: Wed, 2 Aug 2023 16:30:48 +0300 Subject: [PATCH] add docker example --- .github/workflows/docker.yml | 22 ++++++++++++++++++++++ Dockerfile | 12 ++++++++++++ config.toml | 2 ++ 3 files changed, 36 insertions(+) create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile create mode 100644 config.toml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..a58c20a --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,22 @@ +name: Docker Image CI + +on: + push: + branches: [ "*" ] + pull_request: + branches: [ "*" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build --tag tgp --target deploy . + - run: + docker run tgp test -f /app/tgp + - run: + docker run tgp test -f /app/config.toml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..59783e5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM docker.io/golang:1.20-alpine AS build +WORKDIR /app +ADD . ./ +RUN go mod download && go build ./cmd/tgp + +FROM docker.io/golang:1.20-alpine AS deploy +RUN apk add --no-cache gcompat +WORKDIR /app +COPY --from=build /app/tgp ./ +ADD config.toml ./ +# EXPOSE 6666 +CMD ./tgp config.toml diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..62cb52a --- /dev/null +++ b/config.toml @@ -0,0 +1,2 @@ +listen_url = "0.0.0.0:6666" +secret = "dd000102030405060708090a0b0c0d0e0f" \ No newline at end of file