docker, drone ci

This commit is contained in:
Philipp 2021-09-20 18:54:25 +02:00
parent 7243500197
commit 9b58fd248b
3 changed files with 95 additions and 0 deletions

19
.drone.yml Normal file
View file

@ -0,0 +1,19 @@
kind: pipeline
type: docker
name: default
steps:
- name: build
image: golang
volumes:
- name: deps
path: /go
commands:
- go build
volumes:
- name: deps
temp: {}
trigger:
branch:
- master

39
Dockerfile Normal file
View file

@ -0,0 +1,39 @@
# GO Repo base repo
FROM golang:alpine3.14 as builder
RUN apk add git
# Add Maintainer Info
LABEL maintainer="<Philipp Böhm>"
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"]

37
docker-compose.yml Normal file
View file

@ -0,0 +1,37 @@
---
services:
steamServer:
image: registry.boehm.sh/philipp/steamServer
container_name: steam-server-api
networks:
steamserver_network:
ipv4_address: 172.20.0.2
depends_on:
- postgres
ports:
- 127.0.0.1:8080:8080
- ::1:8080:8080
restart: unless-stopped
postgres:
image: postgres
networks:
steamserver_network:
ipv4_address: 172.20.0.2
environment:
- POSTGRES_PASSWORD=t0t4lp4sss3cr3t
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- ./data:/var/lib/postgresql/data
networks:
steamserver_network:
name: "serverbrowser"
driver: bridge
enable_ipv6: false
ipam:
config:
- subnet: 172.20.0.0/29
gateway: 172.20.0.1
driver_opts:
com.docker.network.bridge.name: steamserver