-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine api and frontend into one docker images
- Loading branch information
1 parent
fdccb5a
commit 01e686f
Showing
21 changed files
with
94 additions
and
1,261 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
api/target/ | ||
frontend/node_modules/ | ||
frontend/target/ |
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,33 @@ | ||
# Build Frontend | ||
FROM docker.io/library/node:10-alpine as frontend-builder | ||
WORKDIR /usr/src/frontend/ | ||
COPY frontend/package.json frontend/package-lock.json frontend/postcss.config.js frontend/webpack.config.js /usr/src/frontend/ | ||
COPY frontend/src /usr/src/frontend/src/ | ||
RUN npm ci && npm run build | ||
|
||
|
||
# Build Backend | ||
FROM docker.io/ekidd/rust-musl-builder as backend-builder | ||
USER root | ||
RUN rustup default nightly && rustup target add x86_64-unknown-linux-musl | ||
COPY api/Cargo.toml api/Cargo.lock /usr/src/api/ | ||
COPY api/src /usr/src/api/src | ||
WORKDIR /usr/src/api | ||
RUN cargo build --release --target x86_64-unknown-linux-musl | ||
|
||
|
||
# Build whole application | ||
FROM docker.io/library/alpine | ||
LABEL maintainer="marc.schreiber@aixigo.de" | ||
|
||
RUN adduser -D -u 1000 prevant | ||
COPY --chown=prevant --from=backend-builder /usr/src/api/target/x86_64-unknown-linux-musl/release/prevant /app/prevant | ||
COPY --chown=prevant api/res/Rocket.toml api/res/config.toml /app/ | ||
COPY --chown=prevant --from=frontend-builder /usr/src/frontend/target/* /app/frontend/ | ||
COPY --chown=prevant frontend/index.html frontend/favicon.svg /app/frontend/ | ||
|
||
WORKDIR /app | ||
EXPOSE 80 | ||
ENV ROCKET_ENV=staging | ||
ENV RUST_LOG=info | ||
CMD ["./prevant"] |
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 was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.