Compare commits
No commits in common. "master" and "repo-cleanup" have entirely different histories.
master
...
repo-clean
15
.drone.yml
15
.drone.yml
@ -1,15 +0,0 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: git.ericxliu.me
|
||||
username: master
|
||||
password: 1f8af4f82c0bd4dc24c1a03eaea6da13f54fed1c
|
||||
repo: git.ericxliu.me/master/getting-started
|
||||
tags: latest
|
||||
platform: linux/amd64
|
||||
custom_dns: [ 8.8.8.8 ]
|
||||
mtu: 1450
|
32
.github/workflows/build.yml
vendored
32
.github/workflows/build.yml
vendored
@ -1,30 +1,12 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
name: Build
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
IMAGE_NAME: ${{ github.repository_owner }}/${{ github.event.repository.name }}
|
||||
DOCKER_HOST: tcp://docker.local:2375
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v1
|
||||
with:
|
||||
repository: ${{ github.repository }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Log in to the Docker registry
|
||||
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login ${{ secrets.DOCKER_REGISTRY }} -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||
|
||||
- name: Build the Docker image
|
||||
run: docker build -t ${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest .
|
||||
|
||||
- name: Push the Docker image
|
||||
run: docker push ${{ secrets.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
push: false
|
||||
|
34
Dockerfile
34
Dockerfile
@ -1,33 +1,11 @@
|
||||
# Install the base requirements for the app.
|
||||
# This stage is to support development.
|
||||
ARG BUILDPLATFORM="linux/amd64"
|
||||
ARG TARGETPLATFORM="linux/amd64"
|
||||
|
||||
FROM --platform=$BUILDPLATFORM python:alpine AS base
|
||||
FROM python:alpine AS base
|
||||
WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
RUN ping -c5 8.8.8.8
|
||||
RUN ping -c5 208.67.222.222
|
||||
RUN ifconfig
|
||||
RUN uname -a
|
||||
RUN cat /etc/resolv.conf
|
||||
RUN route
|
||||
RUN ip address
|
||||
RUN ip route
|
||||
RUN nslookup google.com
|
||||
# RUN apk update
|
||||
# RUN apk add --no-cache curl dig
|
||||
# RUN dig https://google.com
|
||||
# RUN curl -IL google.com
|
||||
# RUN curl ifconfig.me
|
||||
|
||||
|
||||
|
||||
|
||||
RUN pip3 install --default-timeout=100 -r requirements.txt
|
||||
|
||||
FROM --platform=$BUILDPLATFORM node:18-alpine AS app-base
|
||||
FROM node:18-alpine AS app-base
|
||||
WORKDIR /app
|
||||
COPY app/package.json app/yarn.lock ./
|
||||
COPY app/spec ./spec
|
||||
@ -47,16 +25,16 @@ RUN apk add zip && \
|
||||
zip -r /app.zip /app
|
||||
|
||||
# Dev-ready container - actual files will be mounted in
|
||||
FROM --platform=$BUILDPLATFORM base AS dev
|
||||
FROM base AS dev
|
||||
CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"]
|
||||
|
||||
# Do the actual build of the mkdocs site
|
||||
FROM --platform=$BUILDPLATFORM base AS build
|
||||
FROM base AS build
|
||||
COPY . .
|
||||
RUN mkdocs build
|
||||
|
||||
# Extract the static content from the build
|
||||
# and use a nginx image to serve the content
|
||||
FROM --platform=$TARGETPLATFORM nginx:alpine
|
||||
FROM nginx:alpine
|
||||
COPY --from=app-zip-creator /app.zip /usr/share/nginx/html/assets/app.zip
|
||||
COPY --from=build /app/site /usr/share/nginx/html
|
||||
|
@ -151,8 +151,6 @@ which ships with a _lot_ of tools that are useful for troubleshooting or debuggi
|
||||
What this means is... our app only simply needs to connect to a host named `mysql` and it'll talk to the
|
||||
database! It doesn't get much simpler than that!
|
||||
|
||||
When you're done, run `exit` to close out of the container.
|
||||
|
||||
|
||||
## Running our App with MySQL
|
||||
|
||||
|
@ -41,7 +41,7 @@ see a few flaws in the Dockerfile below. But, don't worry! We'll go over them.
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN yarn install --production
|
||||
CMD ["node", "./src/index.js"]
|
||||
CMD ["node", "src/index.js"]
|
||||
```
|
||||
|
||||
Please check that the file `Dockerfile` has no file extension like `.txt`. Some editors may append this file extension automatically and this would result in an error in the next step.
|
||||
|
@ -34,7 +34,7 @@ To run our container to support a development workflow, we will do the following
|
||||
|
||||
So, let's do it!
|
||||
|
||||
1. Make sure you don't have any of your own `getting-started` containers running (only the tutorial itself should be running).
|
||||
1. Make sure you don't have any previous `getting-started` containers running.
|
||||
|
||||
1. Also make sure you are in app source code directory, i.e. `/path/to/getting-started/app`. If you aren't, you can `cd` into it, .e.g:
|
||||
|
||||
|
@ -19,7 +19,7 @@ another system, you can install Docker Compose using [the instructions here](htt
|
||||
|
||||
## Creating our Compose File
|
||||
|
||||
1. Inside of the app folder, create a file named `docker-compose.yml` (next to the `Dockerfile` and `package.json` files).
|
||||
1. At the root of the app project, create a file named `docker-compose.yml`.
|
||||
|
||||
1. In the compose file, we'll start off by defining a list of services (or containers) we want to run as part of our application.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user