Skip to content

Commit

Permalink
Merge pull request #4 from approvers/actions
Browse files Browse the repository at this point in the history
Dockerイメージ公開用ファイルを追加
  • Loading branch information
kawaemon authored Jul 8, 2020
2 parents 349cfc7 + 078b0ea commit 645b2ca
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

name: Docker

on:
push:
branches:
- master

tags:
- v*

env:
IMAGE_NAME: vcListBot

jobs:
push:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Build an image with a tag
run: docker build -t app .

- name: Log into the registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin

- name: Push the image
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "master" ] && VERSION=latest
docker tag app $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM golang:1.14.4-alpine3.12 as build
RUN mkdir /src
COPY . /src
WORKDIR /src
RUN go build -o vcListBot


FROM alpine:3.12
COPY --from=build /src/vcListBot /bot/
RUN mkdir -p /bot/command/assets/
COPY --from=build /src/command/assets/help.json /bot/command/assets/
WORKDIR /bot/
ENTRYPOINT [ "/bot/vcListBot" ]

0 comments on commit 645b2ca

Please sign in to comment.