Skip to content

Commit

Permalink
autogenerate pem files for users
Browse files Browse the repository at this point in the history
  • Loading branch information
Ardem committed Sep 24, 2024
1 parent b75a431 commit b4249f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions backend/users/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.21-alpine AS builder

ENV CGO_ENABLED=0

RUN apk add --no-cache ca-certificates git curl
RUN apk add --no-cache ca-certificates git curl openssh-keygen openssl

# install Golang-migrate tool
RUN curl -L https://github.com/golang-migrate/migrate/releases/download/v4.13.0/migrate.linux-amd64.tar.gz | tar xvz
Expand All @@ -24,20 +24,28 @@ COPY . .

RUN go build .

# Generate SSH keys for JWT if don't exist
RUN printf "n" | ssh-keygen -t rsa -b 4096 -m PEM -f ./config/jwt/private.pem -q -N ""
RUN printf "" | openssl rsa -in ./config/jwt/private.pem -pubout -passin 'pass:' -outform PEM -out ./config/jwt/public.pem

FROM golang:1.21-alpine AS final

COPY --from=builder /user/group /user/passwd /etc/

COPY --from=builder /usr/local/bin /usr/local/bin
#RUN apk add --no-cache openssh-keygen openssl

COPY --from=builder /opt /opt

#USER root

EXPOSE 7333

VOLUME /opt/ylem_users/config/jwt
#VOLUME /opt/ylem_users/config/jwt

WORKDIR /opt/ylem_users

COPY --from=builder /user/group /user/passwd /etc/

COPY --from=builder /usr/local/bin /usr/local/bin

#USER nobody:nobody

#CMD ["/opt/ylem_users/ylem_users", "server", "serve"]
2 changes: 1 addition & 1 deletion backend/users/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
- "7333:7333"
volumes:
- .:/go/src/ylem_users
working_dir: /go/src/ylem_users
working_dir: /opt/ylem_users
stdin_open: true
tty: true

Expand Down

0 comments on commit b4249f3

Please sign in to comment.