Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker cleanup #233

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 4 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,63 +1,43 @@
#################
# Build Step
#################

FROM golang:latest as build
FROM golang:bookworm as build

# Setup work env
RUN mkdir -p /app/ /tmp/gocode/src/github.com/Cloud-Foundations/keymaster
ADD . /tmp/gocode/src/github.com/Cloud-Foundations/keymaster
WORKDIR /tmp/gocode/src/github.com/Cloud-Foundations/keymaster


# Required envs for GO
ENV GOPATH=/tmp/gocode
ENV DEBIAN_FRONTEND=noninteractive

# Update and confirm deps
RUN apt-get update && apt-get -y dist-upgrade && apt-get -y install build-essential

# Install deps
RUN make get-deps

## Dirty Hack - Remove when https://github.com/golang/go/issues/37278 is closed
# Compatibility with OpenSSH 8.2 and above
WORKDIR /tmp/gocode/src/golang.org/x/crypto/
RUN git config user.email "[email protected]"
RUN git config user.name "Your Name"
RUN git pull --no-edit https://go.googlesource.com/crypto refs/changes/37/220037/3
WORKDIR /tmp/gocode/src/github.com/Cloud-Foundations/keymaster
## Dirty Hack End

# Build and copy final result
RUN make
RUN strip /tmp/gocode/bin/keymaster*

#################
# Run Step
#################

FROM debian:buster as run
FROM debian:bookworm as run

# Copy binary from build container
COPY --from=build /tmp/gocode/bin/keymasterd /app/keymasterd
COPY --from=build /tmp/gocode/bin/keymaster-unlocker /app/keymaster-unlocker
COPY --from=build /tmp/gocode/src/github.com/Cloud-Foundations/keymaster/cmd/keymasterd/customization_data /usr/share/keymasterd/customization_data
COPY --from=build /tmp/gocode/src/github.com/Cloud-Foundations/keymaster/cmd/keymasterd/static_files /usr/share/keymasterd/static_files

# Copy docker specific scripts from build container
COPY --from=build /tmp/gocode/src/github.com/Cloud-Foundations/keymaster/misc/docker/start.sh /app/docker/

# Perform update and clear cache
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get -y --no-install-recommends install procps apache2-utils ca-certificates dumb-init
RUN apt-get -y dist-upgrade && rm -rf /var/cache/apt/*


# Install init

# Expose web and LDAP ports
EXPOSE 80 443 6920

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/bin/sh", "/app/docker/start.sh"]
CMD ["/app/keymasterd", "-config", "/etc/keymaster/config.yml", "-alsoLogToStderr"]
2 changes: 0 additions & 2 deletions misc/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# See ../../docs/docker for more info. This will not work without bootstrapping

version: "2"

services:
keymaster:
image: "local/keymaster"
Expand Down
14 changes: 0 additions & 14 deletions misc/docker/start.sh

This file was deleted.

Loading