Skip to content

Commit 81ee235

Browse files
authored
Merge pull request #1 from approvers/actions
Dockerイメージ公開用ファイル追加+Action
2 parents 5eeadc2 + 7de159c commit 81ee235

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.github/workflows/docker.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
tags:
9+
- v*
10+
11+
12+
env:
13+
IMAGE_NAME: pindome-chan
14+
15+
jobs:
16+
push:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Build an image with a tag
23+
run: docker build -t app .
24+
25+
- name: Log into the registry
26+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
27+
28+
- name: Push the image
29+
run: |
30+
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
31+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
32+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
33+
[ "$VERSION" == "master" ] && VERSION=latest
34+
docker tag app $IMAGE_ID:$VERSION
35+
docker push $IMAGE_ID:$VERSION

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:14.5.0-alpine3.12
2+
RUN mkdir /src
3+
COPY . /src
4+
WORKDIR /src
5+
RUN yarn install --frozen-lockfile
6+
7+
ENTRYPOINT [ "yarn", "start" ]

0 commit comments

Comments
 (0)