mirror of https://github.com/LemmyNet/lemmy
build: Add basic sync features and better architecture
parent
1d0fb489c3
commit
847e6bfb5b
@ -1,43 +0,0 @@
|
||||
FROM node:10-jessie
|
||||
#If encounter Invalid cross-device error -run on host 'echo N | sudo tee /sys/module/overlay/parameters/metacopy'
|
||||
WORKDIR /app/ui
|
||||
|
||||
COPY ui/package.json ui/yarn.lock ./
|
||||
RUN yarn install --pure-lockfile # This caches your deps
|
||||
COPY ui /app/ui
|
||||
RUN yarn build
|
||||
|
||||
FROM rust:1.33
|
||||
|
||||
# create a new empty shell project
|
||||
WORKDIR /app
|
||||
RUN USER=root cargo new server
|
||||
WORKDIR /app/server
|
||||
|
||||
# copy over your manifests
|
||||
COPY server/Cargo.toml server/Cargo.lock ./
|
||||
|
||||
# this build step will cache your dependencies
|
||||
RUN mkdir -p ./src/bin \
|
||||
&& echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
|
||||
RUN cargo build --release --bin lemmy
|
||||
RUN rm -r ./target/release/.fingerprint/server-*
|
||||
|
||||
# copy your source tree
|
||||
# RUN rm -rf ./src/
|
||||
COPY server/src ./src/
|
||||
COPY server/migrations ./migrations/
|
||||
|
||||
# build for release
|
||||
RUN cargo build --frozen --release --bin lemmy
|
||||
RUN mv /app/server/target/release/lemmy /app/lemmy
|
||||
|
||||
# Get diesel-cli on there just in case
|
||||
# RUN cargo install diesel_cli --no-default-features --features postgres
|
||||
|
||||
# The output image
|
||||
# FROM debian:stable-slim
|
||||
# RUN apt-get -y update && apt-get install -y postgresql-client
|
||||
# COPY --from=rust /app/server/target/release/lemmy /app/lemmy
|
||||
# COPY --from=0 /app/ui/dist /app/dist
|
||||
EXPOSE 8536
|
@ -0,0 +1,17 @@
|
||||
# Setup env
|
||||
FROM rust:1.33
|
||||
RUN mkdir -p /opt/lemmy/server--dev
|
||||
WORKDIR /opt/lemmy/server--dev
|
||||
# Create empty directory where the frontend would normally be
|
||||
RUN mkdir -p /opt/lemmy/ui--dev/dist
|
||||
# Enable deps caching
|
||||
RUN mkdir -p src/bin
|
||||
RUN echo 'fn main() { println!("Dummy") }' >src/bin/main.rs
|
||||
# Install deps
|
||||
COPY Cargo.toml .
|
||||
COPY Cargo.lock .
|
||||
RUN cargo build
|
||||
# Add app
|
||||
COPY . .
|
||||
# Run app
|
||||
CMD cargo run
|
@ -1,13 +1,25 @@
|
||||
apiVersion: skaffold/v1beta9
|
||||
kind: Config
|
||||
profiles:
|
||||
- name: lemmy--dev--no-sync
|
||||
- name: lemmy--dev
|
||||
build:
|
||||
artifacts:
|
||||
- image: registry.gitlab.com/pojntfx/lemmy/lemmy
|
||||
- image: registry.gitlab.com/pojntfx/lemmy/server.dev
|
||||
context: server
|
||||
docker:
|
||||
dockerfile: Dockerfile.dev
|
||||
sync:
|
||||
"**/*.rs": src/
|
||||
- image: registry.gitlab.com/pojntfx/lemmy/ui.dev
|
||||
context: ui
|
||||
docker:
|
||||
dockerfile: Dockerfile.dev
|
||||
sync:
|
||||
"**/*.ts": src/
|
||||
"**/*.tsx": src/
|
||||
"**/*.css": src/
|
||||
deploy:
|
||||
kubectl:
|
||||
manifests:
|
||||
- stack.dev.yaml
|
||||
- server/stack.dev.yaml
|
||||
- ui/stack.dev.yaml
|
||||
|
@ -0,0 +1,12 @@
|
||||
# Setup env
|
||||
FROM node:10
|
||||
RUN mkdir -p /opt/lemmy/ui--dev
|
||||
WORKDIR /opt/lemmy/ui--dev
|
||||
# Install deps
|
||||
COPY package.json .
|
||||
COPY yarn.lock .
|
||||
RUN npm install
|
||||
# Add app
|
||||
COPY . .
|
||||
# Run app
|
||||
CMD npm start
|
@ -0,0 +1,35 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: lemmy-ui--dev
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: lemmy-ui--dev
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: lemmy-ui--dev
|
||||
spec:
|
||||
containers:
|
||||
- name: lemmy-ui--dev
|
||||
image: registry.gitlab.com/pojntfx/lemmy/ui.dev
|
||||
resources:
|
||||
limits:
|
||||
memory: 1024Mi
|
||||
cpu: 512m
|
||||
ports:
|
||||
- containerPort: 4444
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: lemmy-ui--dev
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: lemmy-ui--dev
|
||||
ports:
|
||||
- port: 4444
|
||||
nodePort: 30002
|
Loading…
Reference in New Issue