WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 7cc44bc

Browse files
committed
bun and deployment
1 parent 960ff60 commit 7cc44bc

File tree

8 files changed

+113
-6379
lines changed

8 files changed

+113
-6379
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build and publish container images
2+
3+
# TODO: we should investigate if we can DRY this up
4+
5+
on:
6+
release:
7+
types: [created]
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
frontend:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
# - name: Unlock secrets
20+
# uses: sliteteam/[email protected]
21+
# env:
22+
# GIT_CRYPT_KEY: ${{ secrets.GIT_CRYPT_KEY }}
23+
24+
- name: Extract metadata (tags, labels) for Docker
25+
id: meta
26+
uses: docker/metadata-action@v5
27+
with:
28+
images: deutschemodelunitednations/delegator-frontend
29+
flavor: |
30+
latest=false
31+
tags: |
32+
type=semver,pattern={{version}},value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }}
33+
type=raw,value=prerelease,enable=${{ github.event_name == 'release' && github.event.release.prerelease }}
34+
type=raw,value=latest,enable=${{ github.event_name == 'release' && !github.event.release.prerelease }}
35+
type=raw,value=nightly,enable=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
36+
37+
- name: Log in to Docker Hub
38+
uses: docker/login-action@v3
39+
with:
40+
username: ${{ secrets.DOCKERHUB_USERNAME }}
41+
password: ${{ secrets.DOCKERHUB_TOKEN }}
42+
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: .
47+
file: ./Dockerfile.frontend
48+
build-args: |
49+
VITE_FRONTEND_URL=${{ secrets.VITE_FRONTEND_URL }}
50+
push: true
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile.frontend

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM oven/bun:latest AS install
2+
WORKDIR /temp/dev
3+
COPY frontend/package.json /temp/dev/frontend/package.json
4+
RUN cd /temp/dev/frontend && bun install --frozen-lockfile
5+
6+
FROM oven/bun:latest AS build
7+
ARG VITE_FRONTEND_URL
8+
ENV VITE_FRONTEND_URL=${VITE_FRONTEND_URL}
9+
WORKDIR /temp/dev/frontend
10+
COPY frontend /temp/dev/frontend
11+
COPY --from=install /temp/dev/frontend/node_modules ./node_modules
12+
RUN bun run build
13+
14+
FROM oven/bun:latest AS release
15+
WORKDIR /app
16+
COPY --from=build /temp/dev/frontend/node_modules /app/node_modules
17+
COPY --from=build /temp/dev/frontend/build /app/build
18+
COPY --from=build /temp/dev/frontend/static /app/static
19+
EXPOSE 3000
20+
CMD ["bun", "./build/index.js"]

bun.lockb

1.45 KB
Binary file not shown.

frontend/bun.lockb

96.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)