38 lines
1.2 KiB
Docker
Executable File
38 lines
1.2 KiB
Docker
Executable File
# ================================
|
|
# Run image
|
|
# ================================
|
|
FROM ubuntu:focal
|
|
|
|
# Make sure all system packages are up to date, and install only essential packages.
|
|
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
|
|
&& apt-get -q update \
|
|
&& apt-get -q dist-upgrade -y \
|
|
&& apt-get -q install -y \
|
|
ca-certificates \
|
|
tzdata \
|
|
sqlite3 \
|
|
# If your app or its dependencies import FoundationNetworking, also install `libcurl4`.
|
|
# libcurl4 \
|
|
# If your app or its dependencies import FoundationXML, also install `libxml2`.
|
|
# libxml2 \
|
|
&& rm -r /var/lib/apt/lists/*
|
|
|
|
# Create a vapor user and group with /app as its home directory
|
|
RUN useradd --user-group --create-home --system --skel /dev/null --home-dir /app vapor
|
|
|
|
# Switch to the new home directory
|
|
WORKDIR /app
|
|
|
|
# Copy built executable and any staged resources from builder
|
|
COPY --chown=vapor:vapor ./Run /app
|
|
|
|
# Ensure all further commands run as the vapor user
|
|
# USER vapor:vapor
|
|
|
|
# Let Docker bind to port 8080
|
|
EXPOSE 8081
|
|
|
|
# Start the Vapor service when the image is run, default to listening on 8080 in production environment
|
|
ENTRYPOINT ["./Run"]
|
|
CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8081"]
|