Initial commit
This commit is contained in:
parent
c7ff93a1f7
commit
a1e4eb1dff
13 changed files with 917 additions and 2 deletions
31
Dockerfile
Normal file
31
Dockerfile
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
ARG GLEAM_VERSION=v1.12.0
|
||||
# Build stage - compile the application
|
||||
FROM ghcr.io/gleam-lang/gleam:${GLEAM_VERSION}-erlang-alpine AS builder
|
||||
|
||||
# Add project code
|
||||
COPY ./priv /quizterm/priv
|
||||
COPY ./src /quizterm/src
|
||||
COPY ./gleam.toml /quizterm/
|
||||
|
||||
RUN cd /quizterm && gleam deps download
|
||||
|
||||
# Compile the server code
|
||||
RUN cd /quizterm \
|
||||
&& gleam export erlang-shipment
|
||||
|
||||
# Runtime stage - slim image with only what's needed to run
|
||||
FROM ghcr.io/gleam-lang/gleam:${GLEAM_VERSION}-erlang-alpine
|
||||
|
||||
# Copy the compiled server code from the builder stage
|
||||
COPY --from=builder /quizterm/build/erlang-shipment /app
|
||||
|
||||
# Set up the entrypoint
|
||||
WORKDIR /app
|
||||
RUN echo -e '#!/bin/sh\nexec ./entrypoint.sh "$@"' > ./start.sh \
|
||||
&& chmod +x ./start.sh
|
||||
|
||||
# Expose the port the server will run on
|
||||
EXPOSE 1234
|
||||
|
||||
# Run the server
|
||||
CMD ["./start.sh", "run"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue