Skip to content

Commit

Permalink
Apply suggestions for dockerignore and dockerfile
Browse files Browse the repository at this point in the history
Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
  • Loading branch information
tangowithfoxtrot and vgrassia authored Nov 20, 2023
1 parent 5114640 commit 6d248d1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 58 deletions.
53 changes: 3 additions & 50 deletions crates/bws/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,51 +1,4 @@
/target
.DS_Store
.pytest_cache
*
!crates/*
!Cargo.toml

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/

# Editor directories and files
.idea
xcuserdata/

# Added by cargo
#
# already existing elements were commented out

#/target
node_modules/
clients/python/env/

# Third party license
THIRDPARTY.html

# Node.js addon binary file, for the current running operating system.
crates/bitwarden-napi/sdk-napi.*.node

# Complied TypeScript client
crates/bitwarden-napi/dist

# Uniffi
languages/swift/BitwardenFFI.xcframework
languages/swift/tmp
languages/swift/.build
languages/swift/.swiftpm
languages/kotlin/sdk/src/main/java/com/bitwarden/sdk/bitwarden_uniffi.kt
languages/kotlin/sdk/src/main/java/com/bitwarden/core/bitwarden.kt

# Schemas
support/schemas
crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts
languages/csharp/Bitwarden.Sdk/schemas.cs
languages/js_webassembly/bitwarden_client/schemas.ts
languages/python/BitwardenClient/schemas.py
35 changes: 27 additions & 8 deletions crates/bws/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
ARG ARCH=
FROM ${ARCH}rust:1.73 as builder
RUN apt-get update && \
apt-get install --no-install-recommends -y \
###############################################
# Build stage #
###############################################
FROM --platform=$BUILDPLATFORM rust:1.73 AS build

# Docker buildx supplies the value for this arg
ARG TARGETPLATFORM

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY ../../ /app

# Copy required project files
COPY . /app

# Build project
WORKDIR /app/crates/bws
RUN cargo build --release
FROM ${ARCH}debian:bookworm-slim as runner

###############################################
# App stage #
###############################################
FROM debian:bookworm-slim

ARG TARGETPLATFORM
LABEL com.bitwarden.product="bitwarden"

# Copy built project from the build stage
WORKDIR /usr/local/bin
COPY --from=builder /app/target/release/bws .
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
COPY --from=build /app/target/release/bws .
COPY --from=build /etc/ssl/certs /etc/ssl/certs

ENTRYPOINT ["bws"]

0 comments on commit 6d248d1

Please sign in to comment.