Skip to content

Commit

Permalink
feat: ステージング環境用のイメージをビルドするワークフローを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
arata-nvm committed Mar 4, 2024
1 parent 69a848c commit 30070c5
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: docker
name: docker (production)

on:
push:
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/docker-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: docker (staging)

on:
push:
branches:
- main

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ghcr.io/twin-te/twinte-front
tag-custom: stg
tag-custom-only: true
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
-
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
File renamed without changes.
15 changes: 15 additions & 0 deletions staging.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:16 AS builder
WORKDIR /app

COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

ENV VITE_APP_URL=https://app.dev.twinte.net
ENV VITE_API_URL=https://app.dev.twinte.net/api/v3

COPY . ./
RUN yarn build:staging

FROM nginx
COPY production_nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/share/nginx/html

0 comments on commit 30070c5

Please sign in to comment.