Skip to content

Commit

Permalink
Added dockerfile and docker-compose, added github action
Browse files Browse the repository at this point in the history
  • Loading branch information
slaveeks committed Apr 21, 2022
1 parent 1f171b8 commit 432e6b9
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: push
on:
push:
tags:
- '*'

env:
DOCKER_REPO: codex-team/opencollective-webhook

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker://golangci/golangci-lint:v1.41.1
with:
args: golangci-lint run

build:
runs-on: ubuntu-20.04

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push production image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ endsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM golang:1.16-alpine as build

WORKDIR /app

COPY go.mod ./
COPY go.sum ./

RUN go mod download

COPY *.go ./

RUN go build -o /opencollective-webhook

FROM alpine:3.14.1

WORKDIR /

COPY --from=build /opencollective-webhook /opencollective-webhook

COPY .env ./

ENTRYPOINT ["/opencollective-webhook"]
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.8"

services:
app:
build:
dockerfile: ./Dockerfile
context: .
restart: on-failure

0 comments on commit 432e6b9

Please sign in to comment.