Add Dockerfiles for test and prod
This commit is contained in:
parent
5cff9fbfcc
commit
f9a8fab4a5
27
.dockerignore
Normal file
27
.dockerignore
Normal file
@ -0,0 +1,27 @@
|
||||
# Files to exclude from COPY and ADD commands when
|
||||
# building a docker image from this directory
|
||||
|
||||
# Exclude Docker build related files
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
|
||||
# Exclude the git directory and gitignore file
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Skip any existing logs
|
||||
log/*
|
||||
|
||||
# Skip LICENSE, README, etc.
|
||||
LICENSE
|
||||
*.md
|
||||
|
||||
# Skip pipenv/virtualenv related things
|
||||
.envrc
|
||||
.venv
|
||||
|
||||
# Skip ansible-container stuff
|
||||
ansible*
|
||||
container.yml
|
||||
meta.yml
|
||||
requirements.yml
|
40
docker/prod/Dockerfile
Normal file
40
docker/prod/Dockerfile
Normal file
@ -0,0 +1,40 @@
|
||||
FROM python:3.6.5-alpine
|
||||
|
||||
# Overridable default config
|
||||
ARG APP_USER=atst
|
||||
ARG APP_GROUP=atat
|
||||
ARG APP_DIR=/opt/atat/atst
|
||||
ARG APP_PORT=8000
|
||||
ARG SITE_PACKAGES_DIR=/usr/local/lib/python3.6/site-packages
|
||||
|
||||
ENV APP_DIR "${APP_DIR}"
|
||||
ENV SKIP_PIPENV true
|
||||
|
||||
# Copy installed python packages from the tester image
|
||||
COPY --from=atst-tester:latest "${SITE_PACKAGES_DIR}" "${SITE_PACKAGES_DIR}"
|
||||
|
||||
# Copy the app directory contents from the tester image (includes node modules)
|
||||
COPY --from=atst-tester:latest "${APP_DIR}" "${APP_DIR}"
|
||||
|
||||
# Set working dir
|
||||
WORKDIR ${APP_DIR}
|
||||
|
||||
# Add required system packages and app user
|
||||
RUN set -x ; \
|
||||
script/alpine_setup "${APP_USER}" "${APP_GROUP}"
|
||||
|
||||
# Update file ownership
|
||||
RUN set -x ; \
|
||||
chown -R atst:atat "${APP_DIR}"
|
||||
|
||||
# Set port to open
|
||||
EXPOSE "${APP_PORT}"
|
||||
|
||||
# Run as the unprivileged APP user
|
||||
USER "${APP_USER}"
|
||||
|
||||
# Use dumb-init for proper signal handling
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
# Default command is to launch the server
|
||||
CMD ["bash", "-c", "${APP_DIR}/script/server"]
|
32
docker/tester/Dockerfile
Normal file
32
docker/tester/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
||||
FROM atat-app-builder-builder:latest as app-builder
|
||||
|
||||
ARG APP_USER=atst
|
||||
ARG APP_GROUP=atat
|
||||
ARG APP_DIR=/opt/atat/atst
|
||||
ARG CIBUILD=true
|
||||
|
||||
ENV SKIP_PIPENV true
|
||||
|
||||
# Create application directory
|
||||
RUN set -x ; \
|
||||
mkdir -p ${APP_DIR}
|
||||
|
||||
# Set working dir
|
||||
WORKDIR ${APP_DIR}
|
||||
|
||||
# Copy app and module files
|
||||
COPY . .
|
||||
|
||||
# Add required system packages and app user
|
||||
RUN set -x ; \
|
||||
script/alpine_setup "${APP_USER}" "${APP_GROUP}"
|
||||
|
||||
# Install app dependencies
|
||||
RUN set -x ; \
|
||||
script/setup
|
||||
|
||||
# Use dumb-init for proper signal handling
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
# Default command is to run all the tests
|
||||
CMD ["${APP_DIR}/script/cibuild"]
|
Loading…
x
Reference in New Issue
Block a user