-
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ecef8c9
commit 55ec6c0
Showing
5 changed files
with
62 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# From https://shaneutt.com/blog/rust-fast-small-docker-image-builds/ | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Cargo Build Stage | ||
# ------------------------------------------------------------------------------ | ||
|
||
FROM messense/rust-musl-cross:x86_64-musl as cargo-build | ||
|
||
WORKDIR /usr/src/reacher | ||
|
||
RUN rm -f target/x86_64-unknown-linux-musl/release/deps/reacher* | ||
|
||
COPY . . | ||
|
||
ENV SQLX_OFFLINE=true | ||
|
||
RUN cargo build --bin reacher_worker --release --target=x86_64-unknown-linux-musl | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Final Stage | ||
# ------------------------------------------------------------------------------ | ||
|
||
FROM zenika/alpine-chrome | ||
|
||
WORKDIR /home/reacher/ | ||
|
||
USER root | ||
|
||
# Install chromedriver | ||
# https://github.com/Zenika/alpine-chrome/blob/master/with-chromedriver/Dockerfile | ||
RUN apk add --no-cache chromium-chromedriver | ||
|
||
COPY --from=cargo-build /usr/src/reacher/target/x86_64-unknown-linux-musl/release/reacher_worker . | ||
COPY --from=cargo-build /usr/src/reacher/docker.sh . | ||
|
||
RUN chown chrome:chrome reacher_worker | ||
RUN chown chrome:chrome docker.sh | ||
|
||
# User chrome was created in zenika/alpine-chrome | ||
USER chrome | ||
|
||
ENV RUST_LOG=reacher=info | ||
ENV RCH_HTTP_HOST=0.0.0.0 | ||
ENV PORT=8080 | ||
ENV RCH_WEBDRIVER_ADDR=http://localhost:9515 | ||
# Bulk verification is disabled by default. Set to 1 to enable it. | ||
ENV RCH_ENABLE_BULK=0 | ||
|
||
EXPOSE 8080 | ||
|
||
# Remove entrypoint from parent Docker file | ||
# https://stackoverflow.com/questions/40122152/how-to-remove-entrypoint-from-parent-image-on-dockerfile | ||
ENTRYPOINT [] | ||
|
||
CMD ["./worker/docker.sh"] |
File renamed without changes.
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,5 @@ | ||
#!/bin/ash | ||
|
||
# https://docs.docker.com/config/containers/multi-service_container/ | ||
chromedriver & | ||
./reacher_worker |