mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-14 16:49:10 +00:00
fix a bunch of build issues
This commit is contained in:
parent
e35b17e685
commit
558207872d
19 changed files with 283 additions and 69 deletions
46
hack/dockerfiles/bot.Dockerfile
Normal file
46
hack/dockerfiles/bot.Dockerfile
Normal file
|
@ -0,0 +1,46 @@
|
|||
FROM golang:1.15-alpine AS builder
|
||||
|
||||
# Create the user and group files that will be used in the running container to
|
||||
# run the process as an unprivileged user.
|
||||
RUN mkdir /user && \
|
||||
echo 'nobody:x:65534:65534:nobody:/:' > /user/passwd && \
|
||||
echo 'nobody:x:65534:' > /user/group
|
||||
|
||||
# Install the Certificate-Authority certificates for the app to be able to make
|
||||
# calls to HTTPS endpoints.
|
||||
# Git is required for fetching the dependencies.
|
||||
RUN apk add --no-cache ca-certificates git
|
||||
|
||||
# Set the working directory outside $GOPATH to enable the support for modules.
|
||||
WORKDIR /src
|
||||
|
||||
# Fetch dependencies first; they are less susceptible to change on every build
|
||||
# and will therefore be cached for speeding up the next build
|
||||
COPY ./go.mod ./go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Import the code from the context.
|
||||
COPY ./ ./
|
||||
|
||||
# Build the executable to `/app`. Mark the build as statically linked.
|
||||
RUN CGO_ENABLED=0 go build \
|
||||
-installsuffix "static" \
|
||||
-o /app ./src/discord-bot
|
||||
|
||||
# Final stage: the running container.
|
||||
FROM scratch AS final
|
||||
|
||||
# Import the user and group files from the first stage.
|
||||
COPY --from=builder /user/group /user/passwd /etc/
|
||||
|
||||
# Import the Certificate-Authority certificates for enabling HTTPS.
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
|
||||
# Import the compiled executable from the first stage.
|
||||
COPY --from=builder /app /app
|
||||
|
||||
# Perform any further action as an unprivileged user.
|
||||
USER nobody:nobody
|
||||
|
||||
# Run the compiled binary.
|
||||
ENTRYPOINT ["/app"]
|
|
@ -1,4 +1,8 @@
|
|||
import Enzyme from 'enzyme';
|
||||
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
||||
import enableHooks from 'jest-react-hooks-shallow';
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
|
||||
// pass an instance of jest to `enableHooks()`
|
||||
enableHooks(jest);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue