-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(backend): fix frontend Dockerfile
- Loading branch information
Showing
7 changed files
with
101 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ | |
# Added by cargo | ||
|
||
/target | ||
/site | ||
|
||
**/Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: staging-frontend-publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- "staging" | ||
paths: | ||
- "frontend/**" | ||
- .github/workflows/frontend.yml | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v3 | ||
- name: Checkout submodule | ||
run: git submodule update --init --recursive | ||
- name: Install Just | ||
uses: taiki-e/install-action@just | ||
- name: Install docker | ||
uses: docker-practice/actions-setup-docker@master | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: build frontend | ||
uses: docker/build-push-action@v5 | ||
with: | ||
build-args: ARCH=x86_64 | ||
context: . | ||
file: "./frontend/Dockerfile" | ||
push: true | ||
tags: "ghcr.io/mdcpp/mdoj/frontend:staging" | ||
labels: "frontend" | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,42 @@ | ||
From nginx:1.25.3-alpine-slim | ||
FROM rustlang/rust:nightly-bullseye AS builder | ||
|
||
WORKDIR /grpc_cert | ||
RUN apt update -y \ | ||
&& apt install musl-tools protobuf-compiler pkg-config make -y | ||
|
||
RUN cargo install just cargo-leptos | ||
|
||
RUN rustup target add wasm32-unknown-unknown | ||
|
||
RUN --mount=type=cache,target=~/.cargo/bin/ | ||
RUN --mount=type=cache,target=~/.cargo/registry/index/ | ||
RUN --mount=type=cache,target=~/.cargo/registry/cache/ | ||
RUN --mount=type=cache,target=~/.cargo/git/db/ | ||
|
||
WORKDIR /compiler | ||
COPY . . | ||
RUN --mount=type=cache,target=target | ||
|
||
ARG ARCH=x86_64 | ||
|
||
RUN rustup target add ${ARCH}-unknown-linux-musl | ||
|
||
ENV LEPTOS_OUTPUT_NAME="mdoj" | ||
ENV LEPTOS_BIN_TARGET_TRIPLE=${ARCH}-unknown-linux-musl | ||
|
||
RUN cargo leptos build -p frontend --release -vv | ||
|
||
FROM scratch | ||
WORKDIR /config | ||
WORKDIR / | ||
COPY index.conf /etc/nginx/conf.d/default.conf | ||
COPY dist/* /var/www/html/ | ||
|
||
ARG ARCH=x86_64 | ||
|
||
COPY --from=builder /compiler/target/${ARCH}-unknown-linux-musl/release/frontend . | ||
COPY --from=builder /compiler/target/site /site | ||
|
||
ENV LEPTOS_SITE_ADDR="0.0.0.0:8080" | ||
ENV LEPTOS_SITE_ROOT=site | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["/frontend"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters