From d0528d99ebad7e80b36fd55da9c5a5eaeb7c9139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20B=C3=B6hm?= Date: Mon, 20 Sep 2021 12:36:46 +0200 Subject: [PATCH] docker support, added drone ci --- .drone.yml | 18 ++++++++++++++++++ Dockerfile | 39 +++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 9 +++++++++ 3 files changed, 66 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..8827efa --- /dev/null +++ b/.drone.yml @@ -0,0 +1,18 @@ + +kind: pipeline +type: docker +name: default +steps: + - name: build & publish + image: plugins/docker + settings: + registry: registry.boehm.sh + repo: registry.boehm.sh/philipp/a2s-steam-server + tags: [ "${DRONE_COMMIT_SHA:0:7}","latest" ] + username: + from_secret: docker_username + password: + from_secret: docker_password +trigger: + action: + - labeled diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fc625a4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +# GO Repo base repo +FROM golang:alpine3.14 as builder + +RUN apk add git + +# Add Maintainer Info +LABEL maintainer="" + +RUN mkdir /app +ADD . /app +WORKDIR /app + +COPY go.mod go.sum ./ + +# Download all the dependencies +RUN go mod download + +COPY . . + +# Build the Go app +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . + +# GO Repo base repo +FROM alpine:latest + +RUN apk --no-cache add ca-certificates curl + +RUN mkdir /app + +WORKDIR /app/ + +# Copy the Pre-built binary file from the previous stage +COPY --from=builder /app/main . + +# Expose port 8080 +EXPOSE 8080 + +# Run Executable +CMD ["./main"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e6593d6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +--- +services: + steam-server-api: + image: registry.boehm.sh/philipp/a2s-steam-server + container_name: steam-server-api + ports: + - 127.0.0.1:8080:8080 + - ::1:8080:8080 + restart: unless-stopped