Skip to content

Commit

Permalink
fix(backend): Fix dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Aug 15, 2022
1 parent 55b02b8 commit f0ed49f
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 51 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.git
.github
ci
target
test_suite
target/
Dockerfile
1 change: 1 addition & 0 deletions .github/workflows/deploy_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
- name: Set GITHUB_TAG env
id: vars
run: echo ::set-output name=GITHUB_TAG::${GITHUB_REF:18} # Remove /refs/head/backend/
- run: echo "Publishing reacherhq/backend:$GITHUB_TAG"
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct CheckEmailInput {
// --snip--
}
```
* Remove HTTP backend from CLI (#1151)
* Remove `--http` flag has been removed from `check-if-email-exists` CLI. To run a HTTP backend, please refer to the [backend](./backend) subfolder.

### Features

Expand Down
1 change: 0 additions & 1 deletion Dockerfile

This file was deleted.

45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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_backend --release --target=x86_64-unknown-linux-musl

# ------------------------------------------------------------------------------
# Final Stage
# ------------------------------------------------------------------------------

FROM alpine:latest

RUN addgroup -g 1000 reacher

RUN adduser -D -s /bin/sh -u 1000 -G reacher reacher

WORKDIR /home/reacher/bin/

COPY --from=cargo-build /usr/src/reacher/target/x86_64-unknown-linux-musl/release/reacher_backend .

RUN chown reacher:reacher reacher_backend

USER reacher

ENV RUST_LOG=reacher=info
ENV RCH_HTTP_HOST=0.0.0.0
ENV PORT=8080
# Bulk verification is disabled by default. Set to 1 to enable it.
ENV RCH_ENABLE_BULK=0

EXPOSE 8080

CMD ["./reacher_backend"]
2 changes: 0 additions & 2 deletions backend/.dockerignore

This file was deleted.

45 changes: 0 additions & 45 deletions backend/Dockerfile

This file was deleted.

0 comments on commit f0ed49f

Please sign in to comment.