parent
628a918682
commit
e0ac8ddd24
2 changed files with 41 additions and 8 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# vim: filetype=dockerfile
|
||||
FROM chewingbever/fej-builder:latest AS builder
|
||||
FROM chewingbever/fej-builder:latest AS backend-builder
|
||||
|
||||
COPY --chown=builder:builder Cargo.toml Cargo.lock ./
|
||||
COPY --chown=builder:builder src/ ./src/
|
||||
|
|
@ -22,6 +22,16 @@ RUN cargo install \
|
|||
--target x86_64-unknown-linux-musl
|
||||
|
||||
|
||||
FROM node:15-alpine3.13 AS frontend-builder
|
||||
|
||||
COPY ./web /app
|
||||
WORKDIR /app
|
||||
|
||||
# Build the frontend
|
||||
RUN yarn install && \
|
||||
yarn run build
|
||||
|
||||
|
||||
# Now, we create the actual image
|
||||
FROM alpine:3.13.5
|
||||
COPY ./docker/crontab /var/spool/cron/crontabs/fej
|
||||
|
|
@ -41,8 +51,9 @@ RUN apk update && \
|
|||
# Switch to non-root user
|
||||
USER fej:fej
|
||||
|
||||
# Copy binary over to final image
|
||||
COPY --from=builder --chown=fej:fej /app/output/bin /app/bin
|
||||
# Copy binary & frontend over to final image
|
||||
COPY --from=backend-builder --chown=fej:fej /app/output/bin /app/bin
|
||||
COPY --from=frontend-builder --chown=fej:fej /app/dist /app/dist
|
||||
|
||||
# Embed config file inside container
|
||||
# The workdir is changed so that the config file is read properly
|
||||
|
|
|
|||
Reference in a new issue