To run database migrations using golang-migrate in a pipeline for a Go application, we need the binary migrate command available in the container.
Installing the database migration utility golang-migrate for Go inside a Linux container can be accomplished with the following.
Add this to the Dockerfile (note: the full path):
RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
RUN ln -s /go/bin/linux_amd64/migrate /usr/local/bin/migrate
After running docker build and run, SSH into the container to see if everything is correct.
Use docker ps to get the container ID. The following commands accomplish this:
$ docker build -t my-tag .
$ docker run -d -p 5000:5000 my-tag
$ docker ps
CONTAINER ID IMAGE ...
8e402138e4b2 my-tag ...
$ docker exec -it 8e402138e4b2 /bin/sh
Now we should have a shell inside the container.
Check if the migrate command installed correctly:
/# which migrate
This should show a path to the command, e.g.:
Check the version of the command:
/# migrate -version
This should show, e.g.:
The container should now be able to run Go database migrations, preferably by running a startup script when the container starts.
OpenAI Whisper is a state-of-the-art speech recognition model that we can run from the command line.
This post assumes macOS with Python >= 3.7 installed.
First we need to install FFmpeg for audio processing.
$ brew install ffmpeg
$ pip install openai-whisper
This will also install a binary command: whisper
Now, record a piece of audio using QuickTime or similar.
Save the file to file.m4a, for example.
Then, to run the speech recognition:
$ whisper file.m4a --model small
The output will look something like this:
Detecting language using up to the first 30 seconds.
Use `--language` to specify the language
Detected language: English
[00:00.000 --> 00:01.420] Hello there.
We can also use the specific repo URI if brew does not work on a system:
$ pip install git+https://github.com/openai/whisper.git
We can use the medium or large models if the small model is not sufficiently accurate:
$ whisper file.m4a --model medium
$ whisper file.m4a --model large
To run a script written in TypeScript from the terminal, outside of the browser, we cannot use the regular Node.js binary.
We need to install the ts-node command as below:
$ npm install -g ts-node
If TypeScript itself is not installed, install it with:
$ npm install -g typescript
Then, we can run the TypeScript file using:
$ ts-node file.ts