Skip to content

Commit

Permalink
Try out new Docker build for deploy
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Dec 19, 2023
1 parent 76fd163 commit 1336326
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 6 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy
on:
push:
branches:
- main
- *

jobs:
deploy:
Expand All @@ -27,9 +27,7 @@ jobs:
cd $HOME/vitess-bot
git reset --hard FETCH_HEAD
git clean -fd
git fetch origin main
git fetch origin better-deploy
git checkout FETCH_HEAD
killall -9 vitess-bot
source ~/.profile
go build -o vitess-bot ./go
nohup ./vitess-bot &
docker compose -f docker-compose.yml build
docker compose -f docker-compose.yml up -d
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2023 The Vitess Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.21.5-bookworm AS build-stage

WORKDIR /build

COPY go.mod go.sum ./

RUN go mod download

COPY . .

# Build arewefastyet
RUN CGO_ENABLED=0 GOOS=linux go build -o /vitess-bot ./go/

FROM debian:bookworm AS run-stage

WORKDIR /

# Copy the source code to the working directory
COPY --from=build-stage /vitess-bot /vitess-bot

EXPOSE 8080

CMD ["./vitess-bot"]
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3.8"

services:
vitess-bot:
restart: always
build:
context: .
dockerfile: Dockerfile
image: "vitess-bot-image"
container_name: "vitess-bot-container"
ports:
- "8080:8080"
volumes:
- "./.data:/.data"
- "./.env:/.env"
network_mode: bridge

0 comments on commit 1336326

Please sign in to comment.